cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeIDE not able to get the print on the debug screen for nucleo-wl55jc1

HarshaHegde
Associate

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.

Screenshot 2024-06-19 at 15.11.40.png

in the .ioc file I'm  not able to see the debug option in sys section 

Screenshot 2024-06-19 at 15.13.23.png

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

 

 

}

Screenshot 2024-06-19 at 15.14.44.png
 as we can see the count value is changing. but that is not getting printed.

Screenshot 2024-06-19 at 15.17.45.png

 

What can change here to get the expected result?

2 REPLIES 2
STTwo-32
ST Employee

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.

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.