Skip to main content
bjbfj
Associate
July 5, 2022
Question

Buffering in SWV ITM Data Console?

  • July 5, 2022
  • 2 replies
  • 1663 views

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?

This topic has been closed for replies.

2 replies

Rookie38
Associate III
July 5, 2022

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
bjbfjAuthor
Associate
July 5, 2022

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