cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H5 SWO debugging

AnRe
Associate II

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é

1 ACCEPTED SOLUTION

Accepted Solutions

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");

 

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

View solution in original post

8 REPLIES 8
AScha.3
Chief II

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

 

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

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

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

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

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

 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..)

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

OK, let's go into more detail:

We need to configure the firmware that SWO data will be send. This is unknown to me because I find no information about this. We need to set the right frequency, enable SWO and configure the ITM module...

You mentioned all the time the receiver side to read out the data via debugger. That's clear to me because I did it several times.

 

Question again: Can someone help me with a working register configuration to get SWO running on STM32H503?

 

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");

 

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

Yes, you are right. It's indeed no configuration needed and ITM_SendChar works without configuration of ITM before. 

Thanks for your support