2024-05-01 11:30 PM
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é
Solved! Go to Solution.
2024-05-02 02:30 AM
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");
2024-05-02 12:12 AM - edited 2024-05-02 12:13 AM
Hi,
SWO is not different , its connection to debug unit; if you set everything in "working condition", it will work.
see my debug setting:
2024-05-02 12:38 AM
Well it's not multi-core so won't be as complex as those H7 parts
2024-05-02 01:47 AM
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
2024-05-02 01:49 AM
All the SWO configuration is hidden in this case. How can I confirm that the configuration is correct if I can't see it?
2024-05-02 02:03 AM
> 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..)
2024-05-02 02:10 AM
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?
2024-05-02 02:30 AM
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");
2024-05-02 04:21 AM
Yes, you are right. It's indeed no configuration needed and ITM_SendChar works without configuration of ITM before.
Thanks for your support