cancel
Showing results for 
Search instead for 
Did you mean: 

Buffering in SWV ITM Data Console?

bjbfj
Associate II

I have built a code using the STM32CubeIDE with only 1 task

void StartMyTask(void *argument)

{

 /* USER CODE BEGIN 5 */

 /* Infinite loop */

  char c = 'A';

 for(;;)

 {

  ITM_SendChar(c); //sends the char c to the PC debugging terminal

  osDelay(500);

 }

 /* USER CODE END 5 */

}

When I debug this code, I see "AAAAAA..." in the SWV ITM Data Console; however, they appear in pairs... I've noticed that the pairs appear every 1s, which suggests that the MCU is sending the data at the desired 0.5s interval...

does anyone know if the SWV ITM Data Console does any buffering? Is there any way to configure it so that it updates faster?

2 REPLIES 2
Rookie38
Associate III

This post explains how to turn off the buffering of printf messages. Maybe this will help you:

https://community.st.com/s/question/0D50X0000AuqfAaSQI/how-to-redirect-printf

bjbfj
Associate II

Hi Rookie38,

Thank you for your response. I tried all 3 options described in the link (sending '\n', using setvbuf, and fflush(stdout)), but still had the same problem. I experimented more with it and I wonder if it is related some configuration of my board NUCLEO-64 STM32L476RG: I increased the osDelay(500) to osDelay(5000) and with this delay, the "A"s appear 5s after each other (i.e, no longer in pairs)...

bjbfj