Close

Trace Viewer Module

A project log for STMViewer

STM32 non-intrusive realtime data visualizer

peter-wasilewskiPeter Wasilewski 09/18/2023 at 17:090 Comments

Trace Viewer is a new module that is implemented in the STMViewer software. It allows to visualize SWO pin trace data on digital or "analog" plots.

 If you ever used GPIO pins to confirm a timer interrupt frequency, check how long a function takes to execute, or diagnose preempting interrupts you know how it's like to pull out an oscilloscope or logic analyzer and solder some wires to the prototype. It's quite annoying to set up, takes a lot of time, and you cannot easily connect mulitple channels. The Trace Viewer uses only and ST-Link programmer and it'a ability to read SWO output. Thanks to a trace peripheral in Cortex M3/M4/M7/M33 cores it is possible to measure sub-microsecond time periods (depending on your System Core Clock). 

To create a datapoint on a plot you simply write a registers of the ITM peripheral like so: 

ITM->PORT[x].u8 = 0xaa;

As you can see this method is almost non intrusive when we consider the time it takes for the micro controller to execute it. After that the trace peripheral takes all the work, creating relative timestamps and attaching them to bytes that are later sent through SWO pin. 

If you're still interested check out the README.md for more info on how to get started!

Discussions