The CPU uses the TPIU macro inside the processor to support the serial wire viewer (SWV) interface (a single-line interface). Use the following sequence to enable SWV output on the CPU:
- Enable the trace system (CPU_DCB:DEMCR.TRCENA)
- Enable ITM (CPU_ITM:TCR.ITMENA)
- Enable the desired stimulus port (0 to 31) (CPU_ITM:TER0)
- Change formatter configuration, if needed (CPU_TPIU:FFCR)
- Change the pin protocol, if needed (CPU_TPIU:SPPR)
- Set the baud rate (CPU_TPIU:ACPR)
- The SWV can be mapped to DIOn by writing the corresponding port ID in the IOC:IOCFGn . For more details, see Chapter 400.
- Set which stimulus ports can be accessed by unprivileged code (CPU_ITM:TPR)
Writes to the CPU_ITM:STIMn registers (assuming that they are enabled) trigger a transmit on SWV output if the FIFO is not full.