Loading...
 

System Workbench for STM32


SWO debugging not working

Hello,

I’m trying to output data through the SWO but I don’t even see anything happening on the PB3 pin using an oscilloscope.

I don’t want to use semihosting, and I don’t even need printf to work either. I simply want to output chars on the SWO line. I’ve read dozens of posts on this forum and others, and as many suggest I’m simply calling ITM_SendChar(uint32_t ch), but it doesn’t do anything. More precisely, if debugging with checkpoints, I can see that the following check in this function doesn’t pass:

if ((ITM->TCR & ITM_TCR_ITMENA_Msk) && /* ITM enabled */
     (ITM->TER & (1UL << 0))) /* ITM Port #0 enabled */

is always false. So it makes me think something is maybe not initialized correctly? By the way I’m not using code generated by CubeMX, is there anything I should do to allow SWO (ITM) to be used?

My process for testing is to launch debugging inside System Workbench for STM32, start the code, and then stop it, open the ST-LINK Utility “Printf via SWO viewer” and start it with my system clock (168000000 Hz, I’m on a stm32f405rg). I double checked that the PB3 pin is connected to the SWO header pin on my STLINK-V3. As mentioned, I’m also monitoring the PB3 pin with an oscilloscope, but nothing happens on it at any time during the process.

What am I doing wrong?
Thanks

 

Newest Forum Posts

  1. Problem programming chip by JimELi, 2019-03-25 21:26
  2. CubeMT code, generated for SW4STM32 by market14, 2019-03-25 03:57
  3. Problem verifing and downloading code by strohmas, 2019-03-24 23:16
  4. Nucleo-144 TCP Problems by mklee, 2019-03-22 19:25
  5. CubeMX function pack development by ajcurtis84, 2019-03-22 18:59
  6. STM32CubeMX LWIP not working by leflingue, 2019-03-22 12:22
  7. STM32CubeMX LWIP not working by matsjuhlin, 2019-03-22 09:13
  8. STM32F746-Discovery by stanandrzej, 2019-03-21 12:41
  9. System Workbench takes up to five minutes to load by Servant, 2019-03-21 02:39
  10. How to use multiple ST boards simultaneously by Kevarek, 2019-03-20 19:21

Last-Modified Blogs