Setting Up and Using Instruction Trace

oPIC32 instruction trace requires hardware and software setup before you can trace.

Hardware Setup – PIC32 MCU on PIM

To use the PIC32 Instruction Trace feature with the PIM, do the following:

  1. Plug the PIM into an unpowered target board.
  2. Install communication cable(s) between the emulator and your target board. See the "Emulator Communication with the Target" page or the "Performance Pak for the MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide" (DS50002528).
  3. Connect the trace cable from the trace port on the PIM to the trace adapter board. Orient the cable as shown in Figure 1. For hardware details, see the MPLAB REAL ICE "Trace Interface Kit Specification" (DS50002531).
  4. Plug the trace adapter board into the MPLAB REAL ICE in-circuit emulator logic probe port. The top of the adapter board contains the connectors and should be oriented upwards when plugging the board into the logic probe port (Figure 1).
  5. Power the target.

Note: When using trace, pins TRCLK and TRD3:0 are used. Therefore, you cannot use the other functions multiplexed on these pins. For PIC32MX360F512L, multiplexed functions are RG14:12 and RA7:6. Check your device data sheet for details.

InstructionTrace_PIM.jpg
Figure 1: Trace Connection with PIM

Hardware Setup – PIC32 MCU on Target

When designing instruction trace capability onto your own board, the following provisions will need to be made.

  • Termination series resistors will need to be added. For details, see the MPLAB REAL ICE "Trace Interface Kit Specification" (DS50002531).
  • Depending on your board routing and loading of the signals used for trace, it is a good idea to place 0 Ω resistors that can be unpopulated to isolate the trace signals TRCLK and TRD3:0.

To use the PIC32 Instruction Trace feature with your own board do the following:

  1. The target board should initially be unpowered.
  2. Install communication cable(s) between the emulator and your target board. See the "Emulator Communication with the Target" page or the "Performance Pak for the MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide" (DS50002528).
  3. Connect the trace cable from the target board to the trace adapter board. Make sure the PIC32 MCU on your target board is connected to accommodate trace, as per Figure 2. For hardware details, see the MPLAB REAL ICE "Trace Interface Kit Specification" (DS50002531).
  4. Plug the trace adapter board into the MPLAB REAL ICE in-circuit emulator logic probe port. The top of the adapter board contains the connectors and should be oriented upwards when plugging the board into the logic probe port (Figure 2).
  5. Power the target.

Note: When using trace, pins TRCLK and TRD3:0 are used. Therefore, you cannot use the other functions multiplexed on these pins. For PIC32MX360F512L, multiplexed functions are RG14:12 and RA7:6. Check your device data sheet for details.

InstructionTrace_Device.jpg
Figure 2: Trace Connection with Device on Target

MPLAB X IDE Setup

To set up MPLAB X IDE to use trace for the MPLAB REAL ICE in-circuit emulator:

  1. Right click on the project name and select Properties. In the Project Properties dialog, click on Real ICE (under Categories).
  2. Under Option categories, select Trace and Profiling.
  3. Under Data Collection Selection, choose Instruction Trace/Profiling.
  4. Set up any other trace-related options.
  5. Click OK.

On a Debug Run, trace will continue to fill the trace buffer with data, rolling over when the buffer is full, until a program Halt.

Viewing Trace Data

When trace is enabled and code is run, trace data will be collected by the emulator. Once the device is halted, trace data will be decoded and displayed in the Trace window (Window > Debugging > Trace).

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.