Debug and Programming Limitations - PIC® MCUs

Last modified by Microchip on 2023/11/09 09:10

Overview

In-circuit debugging induces limitations on device operation for Microchip PIC® microcontrollers (MCUs), as well as dsPIC® digital signal controllers (DSCs). These limitations are broken down into general limitations, device family limitations, and specific device limitations.

Caveats

Not all device issues are related to development tools. Some devices have silicon errata. Please see the Microchip website for errata pertaining to your selected device.

Some development tools (e.g., emulators) expose special device features (e.g., trace). Limitations on these features are marked (EM).

The "Hardware Tool Debug Features by Device" PDF lists all the supported debug features for every device.  

General Debug Limitations

General Debug Limitations are limitations that apply to devices for the debug function.

  • The debugger/emulator uses several on-chip resources when debugging. Refer to the reserved resources section of this help file.
  • The debugger/emulator has different debug features available, depending on the selected device.
  • Depending on the debugger/emulator, there are issues with Freeze on Halt support as well as other device debug issues.
  • If you modify Program Memory, you must reprogram the device in order to program the changes into the target.
  • The Reset command resets the program, goes to the zero location, and halts. The program does not automatically rerun.
  • User ID memory cannot be changed when in Debug mode.
  • 16-bit timer high byte overwritten. For 8-bit devices: Whenever TMR0L is read, the TMR0H latch is updated with what is in the internal timer. When TMR0L is in an MPLAB® X IDE window (e.g., Watch window) and you step or halt your code, TMR0L is read to update that window, causing an update to TMR0H from the internal timer.
  • MPLAB X IDE Read limitation for buffers. When MPLAB X IDE reads a transmit or receive buffer, such as the UART module UxRXREG register, it may corrupt the data. To avoid this condition, do not set a breakpoint or step through code that reads these buffers. Also, avoid setting a Watch on these buffers. To read a receive buffer, move the data into another register and read that register.
  • The clock speed in the status bar is not relevant. Clock speed is set by the target oscillator; it is not controlled or measured by MPLAB X IDE.
  • If you attempt to single step over an invalid two-word instruction, the Program Counter moves to the 2A location.
  • Some devices have a BF, RCIF and PORTB issue. A workaround for the BF, RCIF and PORTB issue would be to not have SSPBUF, RCREG or PORTB in an open Watch or File Register window.
  • LVP disabled for debugging. Low-voltage ICSP programming is disabled for devices that support this type of programming. The emulator/debugger does not support Low Voltage Programming (LVP) and will disable this function. You cannot enable it through programming using the debugger. However, you can enable it through a dedicated programmer, such as MPLAB PM3 Universal Device Programmer.
  • Flash memory windows need to be read on change. When a Flash memory value changes or the processor is halted, the data in that memory window (e.g., Program Memory window) is not updated; you must do a Read of device memory.

Back to Top

Breakpoints

​Software breakpoints may not be available on all debuggers/emulators. Check the specific tool’s user’s guide for breakpoint information.

  • Breakpoints set in code protected segments do not halt the processor.
  • Software breakpoints and POR. If a POR occurs and software breakpoints are turned on, you must reprogram your target before continuing. Failure to do so may cause spurious halts.
  • Limited hardware breakpoints available. Only a certain amount of breakpoints are available when using the debuggers/emulators. The actual number varies depending on the selected device. View the Device Debug Resource toolbar for information on the number of available and used breakpoints. See MPLAB X IDE Help for more information on the toolbar.
    For 8- and 16-bit devices, breakpoints, data captures, and runtime watches use the same resources. Therefore, setting a data capture or runtime watch uses the resource for the selected symbol.
    As a general rule:
DevicesNumber of Hardware Breakpoints
PIC12F/16F/16F1xxx devices1
PIC16F1xxx enhanced devices1 to 3 (Note 1)
PIC18F devices1
PIC18F enhanced devices3
PIC18FxxJ devices3 or 5 (Note 2)
PIC18FxxJ devices3 or 5 (Note 2)
dsPIC30F devices2
dsPIC33F/PIC24 devices4
PIC32MX devices6
Note 1: Refer to the Development Tools Selector (DTS) on microchip.com to select your device and determine the number of available breakpoints for the device and its related processor extension pack or debug header.
Note 2: There is a limitation for these devices that only one data capture is available.
  • Hardware breakpoint skidding may occur on Halt. Hardware breakpoints may skid on Halt (not Halt on the instruction where the breakpoint is located) based on the device and type of memory on which they are set, as described below:
Device FamilyNo. of Instructions Skid*
Program MemoryData Memory
PIC12F/16F/18F MCUs12
PIC12F1XXX/16F1XXX00
PIC24 MCUs and dsPIC DSCs22
PIC32MX MCUs00
* Using single stepping to reach a breakpoint will not produce a skid.

Back to Top

Data Capture, Runtime Watches, and Trace (EM)

​Not all devices support data capture, runtime watches and/or trace. See the Development Tools Selector (DTS) on the Microchip website for more information on features supported on your device.

​Trace may not be available on all debuggers/emulators. Check the specific tool’s user’s guide for trace information.

  • Clock switching is available for data capture and trace, but you must set the clock correctly on the Clock tab of the Setting dialog or you may see issues.

Back to Top

8- and 16-bit Devices

  • In-line assembly code (assembly code within C code) cannot be traced.
  • Native trace and data capture/runtime watches cannot be used together.
  • For native trace at speeds higher than 15 MIPS, the Performance Pack may be needed. The actual cutoff speed may vary depending on layout, noise, and similar considerations.
  • When trace overflows, you may get the message in the Output window:
    “Unrecognized streaming data header, xx received”
    and trace data may not be valid.

Back to Top

32-bit Devices

  • Trace can be used with either data capture/runtime watches or Application In/Out, but not both. You can, however, use both data capture/runtime watches and Application In/Out.

Back to Top

General Programming Limitations

General Programming Limitations are limitations that apply to devices for the programming function.

  • Care should be taken when programming the Phase-Locked Loop (PLL). The PLL only changes when power is first applied to the chip. If you are programming the PLL for the first time, remove power from the PIC18 part after programming and reapply for the PLL to be enabled. If you are reprogramming the device from PLL mode to another mode, first reprogram with PLL off, then remove the power and reapply.
  • For all devices with EEPROM memory, erase operations will also erase EEPROM memory.
  • If your code makes use of port pins that correspond to clock and data pins* in Programming mode, you may not be able to reprogram your device.
    When Internal Master Clear (MCLR) is used with the debugger or emulator for programming, both Vpp and Vdd are powered together. Then, Vpp is pulled high to Vihh to enter Programming mode. This means that your code will be running before Vpp goes to Vihh. If that code makes use of port pins that correspond to clock and data pins in Programming mode, there is a chance their values may not be 0, as necessary to enter Programming mode. Therefore, the device could not be reprogrammed.

Back to Top

Workaround

When External MCLR is used, this is not a problem, as Vpp can go directly to Vihh. Also, if the external oscillator is used, it can be kept from running, thus, keeping the code from running, until Vpp is at Vihh.

*Clock and Data Pins: Please refer to the Programming Specification for your device to determine which port pins correspond to the clock and data pins used in device programming. E.g., for many Microchip devices, those pins are RB6 and RB7 respectively.

Back to Top

General Device-ME2/ICE/ICD Limitations

The -ME2, -ICE or -ICD versions of a device (e.g., PIC12F629-ICD) are always mounted on a header board and only used for debugging. For information on headers, see either:

  • (-ICE/-ICD) "Processor Extension Pak and Debug Header Specification" (DS50001292)
  • (-ME2) "Emulation Extension Pak and Emulation Header User’s Guide" (DS50002243)

Limitations related to these device versions are as follows:

  • For some devices, only the -ME2, -ICE or -ICD version of the device can be used to debug with the debug tool. See the above documents to determine if your device requires this device version to debug.
  • -ME2, -ICE, and -ICD devices on headers must be clocked (internally on INTOSC or externally on OSC1) and have MCLR high to communicate with the debug tool.

Back to Top