Jump to content
  • 0

Debugging low pincount PICmicrocontrollers



1 answer to this question

Recommended Posts

  • Member

In circuit debugging a PIC microcontroller requires 3 features from the chip in both hardware and software.  

1) a Debug Exec (software)

2) In Circuit Debug Hardware (ICD) (silicon)

3) a method of communicating with the debugger (I/o pins)

The software is a special "debug exec" that is placed in special test memory by the debugger.  This "debug exec" provides the serial interface to the debugger and follows the debugger's commands to interact with the hardware debugging support.  The "debug exec" uses some CPU resources like 1 level of stack and a few bytes of RAM in addition to some program memory.  On the "enhanced" PIC16's (all the PIC16F1xxx devices) additional stack, ram and flash memory is added so there is no memory penalty for using the debugger.

The hardware is a number of silicon features like address/data match comparators that implement the breakpoints.  The number of hardware breakpoints is related to the number of these comparators that are physically implemented in the silicon.  The breakpoints must be implemented in hardware if they are to have zero impact on your code.  Software breakpoints are literally extra instructions inserted to perform the breakpoint and they cannot be "turned on/off" and they will affect the program size/timing.

The I/O pin requirement is for a communications path to the "debug exec" and for an external way to trigger a manual "HALT".  This is done through the PGC/PGD pins so no additional pins are "wasted" beyond what you need for programming.

Because the hardware portion of debugging requires additional silicon area and only the developers will ever need it, many of the lower cost devices remove it to save cost.  Instead a special version of the device is created and sold on a debug header.  The debug header (part number AC162059 for the 12F508) provides the ICD silicon so the volume production does not need to pay for a feature they will never use.

For low pin count devices such as the 12F508, it is extra tricky because with only 8 total pins and 5 I/O pins, it is not reasonable to build an application and use debug as that will leave 3 I/O pins for your "secret sauce".  For these devices the special part on the debug header is actually in a larger package with 8 pins exactly the same as the target device and additional pins to implement programming & debugging.  This allows a nearly zero impact solution to debugging but does require buying an additional device.

If you are a maker and are concerned with the minimum size option, I recommend you get good at soldering QFN packages.  For the same size as an SOIC 8, you will get 20 pins and in a PIC16F1xxx device you will also get debugging, more memory, better peripherals and a lower cost.

Good Luck

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...