Skip to main content
Explorer
May 2, 2024
Solved

STM32H5 SWO debugging

  • May 2, 2024
  • 3 replies
  • 5553 views

Hi,

 

We want to use now the STM32H5 for future projects. In the past, we used STM32F4 with enabled SWO for debugging. Is there any example available to get this feature working for STM32H503? Would be great to do it on register level to be independent from IDE...

I've already read this thread: Solved: Re: STM32H7 SWO printf not working - Page 3 - STMicroelectronics Community

But I'm not sure about the differences between H5 and H7

 

Thanks for your help,

André

    This topic has been closed for replies.
    Best answer by AScha.3

    Ahh, ok. You want send some printf(..)   as debug info etc. - right ?

    Thats easy -> 

    >with a working register configuration to get SWO running

    no need - debug unit is "always ready to work" . :)

    -> just put this at end of main.c (...see : user code..)

    int __io_putchar(int ch)
    {
     ITM_SendChar(ch);
     return (ch);
    }
    
    
    /* USER CODE END 4 */

    Then can use printf and it will come to SWO -> console . (always with \r \n , at end ! )

    printf("************** RTOS start ****************\r\n");

     

    3 replies

    Super User
    May 2, 2024

    Hi,

    SWO is not different , its connection to debug unit; if you set everything in "working condition", it will work.

    see my debug setting:

    AScha3_0-1714633932315.png

     

    AnReAuthor
    Explorer
    May 2, 2024

    All the SWO configuration is hidden in this case. How can I confirm that the configuration is correct if I can't see it?

    Super User
    May 2, 2024

     is hidden in this case

    in wich case ? 

    In IDE i showed , what to set in debug setup. (For jlink tools - i dont know. You should ask this at Segger..)

    Graduate II
    May 2, 2024

    Well it's not multi-core so won't be as complex as those H7 parts

    AnReAuthor
    Explorer
    May 2, 2024

    Hi,

    like I already mentioned, I want to do it IDE-independent based on register access and I want to use the tool J-Link SWO Viewer. The IDEs do lot of magic stuff ;)

    Unfortunately, I found no details in datasheet or reference manual.

    BR