cancel
Showing results for 
Search instead for 
Did you mean: 

Debugging with ITM not working with SWV in STM32CubeIDE

evenlund
Associate III

I am successfully using all the SWV debugging functionality in STM32CubeIDE except for the ITM functionality, as described in UM1609 and in the advanced debugging videos on youtube from ST.

I have both tried overriding the "_write " function in main.cpp or replacing "__IO_putchar" with "ITM_SendChar" in syscalls.c, but I don't see any output when using printf and ITM port 0 (described in video 4 and section 4.3.5 in UM1609).

I have further tested sending output to ITM port 31, as described in video 5, but still cannot see any output.

Some details and further questions

  • SWO is left unconnected - Do I need to connect the SWO to some other pin to make ITM work?
  • I am running at 180 MHz clock speed - Is this too fast for ITM?
  • Does it matter if I compile for cpp rather than c?
  • Are there any benefits to updating an ITM port, like in video 5, rather than updating a global variable and observing the execution order by looking at a graph in a SWV Data Trace Timeline Graph or in CubeMonitor?
  • Any further suggestions of why I can make all but ITM work for me with Nucleo-F446RE?
1 ACCEPTED SOLUTION

Accepted Solutions
evenlund
Associate III

I finally figured out that it was the clock speed that was the problem. I am not sure what the limit is for running ITM is, but it is working for 84 MHz and not on 180 MHz. I assume that the other SWV traces will also be inaccurate at high clock as data will be lost in transfer and not be shown in graphs and logs.

View solution in original post

6 REPLIES 6
evenlund
Associate III

I have tried ruling out a few things by copying the code from the youtube ST advanced debugging video series:

  • I am running at 180 MHz clock speed - Is this too fast for ITM? I have tried setting this now to default 84 MHz, like in the video, but I get no difference. Edit: I forgot to include the _write function and it was working at 84 MHz.
  • Does it matter if I compile for cpp rather than c? Not working for C either.

The advanced debugging capabilities in STM32CubeIDE is really impressive if i can make it work. Can someone test the ITM functionality on a different MCU or board? Preferably on a M4.

evenlund
Associate III

Tested now also the original code from ST (http://bit.ly/AdvDebugMaterials) with my Nucleo-F722ZE on 216 MHz default system clock, but I still get no output from ITM. All other SWV functionality is working. What am I missing?

TDK
Guru

> SWO is left unconnected

Fairly sure SWO is used to transfer ITM information.

If you feel a post has answered your question, please click "Accept as Solution".

Check with STM32 Cube Programmer or ST-LINK Utilities, both have a SWV Viewer

There must be a common understanding of the clock speeds.

Print those clocks out, perhaps also pull the SWO divider value out.

Double check solder bridges on DISCO and NUCLEO boards, ensuring PB3/SWO get to the debugger, and the pin isn't reconfigured elsewhere.

Check RCC/GPIO registers.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
evenlund
Associate III

I finally figured out that it was the clock speed that was the problem. I am not sure what the limit is for running ITM is, but it is working for 84 MHz and not on 180 MHz. I assume that the other SWV traces will also be inaccurate at high clock as data will be lost in transfer and not be shown in graphs and logs.

Andre_k
Associate III

Updating to the ST-Link current latest version 3.14.5 fixed the issue for me. Try that first before attempting to downgrade your ST-Link. I have testet this with an STM32G491RE-Nucleo and STM32CubeIDE version 1.15.

Hope this helps 🙂

Edit: Clock speed should not be an issue, I have testet it at 170MHz. The clock is anyway prescaled down as shown in the upper left under "Clock Settings".

Andre_k_0-1712739168097.png