STM32CubeIDE not able to get the print on the debug screen for nucleo-wl55jc1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-06-19 2:51 AM - last edited on ‎2024-06-19 3:26 AM by STTwo-32
HI,
I'm new to STM programming. I have set up everything and I'm able to load the program to the board. but when I'm trying to print some lines to the SWV data console, nothing is getting printed. I have used the example UART printf program that is given by the example of ST projects.
I'm using STLink and below is my configuration for debugging.
in the .ioc file I'm  not able to see the debug option in sys section
this is how I'm getting the debug screen. no error but no prints are coming on the swv data console
below is my while loop code to print the count value. count
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
printf("The counter value: %d /r/n", count);
count++;
HAL_Delay(1000);
}
 as we can see the count value is changing. but that is not getting printed.
What can change here to get the expected result?
Solved! Go to Solution.
- Labels:
-
STM32WL series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-07-27 3:21 AM - edited ‎2024-07-27 3:23 AM
1. set swo active in debug
2. set printf in main , at the end... ->
...
int __io_putchar(int ch)
{
ITM_SendChar(ch);
//HAL_UART_Transmit(&huart3, (uint8_t *)&ch, 1, 0xFF); unkomment, if want send on uart also
return (ch);
}
/* USER CODE END 4 */
...
3. write something in main loop ...to see it:
printf("check ! \n");
4. in debug , pause or at main/brkpt , start sdv , with the red button : (might not work on first try ! try again..)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-06-19 3:26 AM
Hello @HarshaHegde
you can have a look to AN4989 STM32 microcontroller debug toolbox. The part 7.3 of this AN explains how to do debugging with printf on all three IDEs (IAR, Keil, CubeIDE).
For the Debug option, is available on the .ioc file under the category "Trace and Debug".
Best Regards.
STTwo-32
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-06-19 10:55 PM
HI @STTwo-32
Thanks for the reply. I followed the same thing in the document.
I have added the code in the syscalls.c
#include "stdio.h"
int __io_putchar(int ch)
{
ITM_SendChar(ch); return(ch);
}
Here I got the error for ITM_SendChar . so first I tried to add #include <core_cm4.h> but I also got an error.
so I added a custom function
void ITM_SendChar(uint8_t ch)
{
//Enable TRCENA
DEMCR |= ( 1 << 24);
//enable stimulus port 0
ITM_TRACE_EN |= ( 1 << 0);
// read FIFO status in bit [0]:
while(!(ITM_STIMULUS_PORT0 & 1));
//Write to ITM stimulus port0
ITM_STIMULUS_PORT0 = ch;
}
this time it got compiled without any issues. but still, I'm not getting any data on port0 of the SWV data console.
Please let me know if there is anything else I can change.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-07-24 7:24 AM
Any updates. Have you followed all steps.
Best Regards.
STTwo-32
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-07-27 2:58 AM
No, I Didn't get any solution even after following all the steps.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-07-27 3:21 AM - edited ‎2024-07-27 3:23 AM
1. set swo active in debug
2. set printf in main , at the end... ->
...
int __io_putchar(int ch)
{
ITM_SendChar(ch);
//HAL_UART_Transmit(&huart3, (uint8_t *)&ch, 1, 0xFF); unkomment, if want send on uart also
return (ch);
}
/* USER CODE END 4 */
...
3. write something in main loop ...to see it:
printf("check ! \n");
4. in debug , pause or at main/brkpt , start sdv , with the red button : (might not work on first try ! try again..)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-07-29 9:26 PM
SB8 soldering was missing on my board.
