Serial Port Interface (SPI) trace, or simply serial trace, is a type of instrumented trace. This means that MPLAB® X IDE and MPLAB XC C compiler support are required. Also, the device must have an SPI peripheral.
For more information, see the "SPI Trace" section on the "Types of Instrumented Trace" article.
SPI Trace Connections
For serial trace, use the device SPI and pins 7 (DAT) and 8 (CLK). The device is connected to the target using high-speed/LVDS communication hardware which provides the extra lines for clock and data. The device does not have to be operating at high speeds to use this feature.
The figure shows the proper connections. As with pins 4 (PGD) and 5 (PGC), do not use pull-up or pull-down resistors, capacitors or diodes ("Target Circuit Design Precautions").
The DAT and CLK lines are intended for use with devices that do not have built-in debug logic that allows tracing (Native trace) to use the PGD/PGC/EMUC/EMUD pins. The DAT line connects to either the target device SPI port SDO1 or SDO2. The CLK line connects to SCK1 or SCK2.
SPI Trace Usage
When you dedicate SPI pins to tracing, any multiplexed function on these pins cannot be used by the application.
For devices with remappable peripheral pins, be aware that the SPI Trace macro does not touch any PPS register and does not need to know how the peripheral is mapped to a certain pin – it will write to the SPI1 or SPI2 selected in MPLAB X IDE.
SPI trace does require that you enter the clock speed (in the Properties dialog, click the REAL ICE category, and the Clock options category.)