Showing results for 
Search instead for 
Did you mean: 

Terminal flickering when sending characters through UART

Associate II


I am attempting to create a guitar hero-style game using the B-L4S5I-IOT1A board. I have an array representing the notes to play and wish to update the display every 125ms with a new gameplay frame (a given frame has the next 10 notes the user must play).

Currently, I am overriding the void HAL_TIM_PeriodElapsedCallback() function to print to the screen using UART. I have attached my UART configuration below:


Additionally, I have an array with values from 0 to 7 where the number represents the button configuration to be pressed (ex/ 3 is 011 indicating button 2 and 3 should be pressed at this point in time) and the logic and code I used to create the "gameplay frame" string is shown below:




and I transmit the string as follows:

HAL_UART_Transmit(&huart1, (uint8_t*)bufferFrame, strlen(bufferFrame), HAL_MAX_DELAY);

However, when I observe the output in the terminal, I find that the terminal appears to occasionally flicker (unfortunately it seems I dont have permission to upload video so I cannot show an example of exactly what I mean by flicker). I was wondering if anyone has encountered such a problem or may know of a solution. Thanks!



Chief II

Initiate somethinks as UART inside other IRQ callback isnt good idea. Too how time is your timer repeat?

Video you can upload on other place and here place link

Pavel A.
Evangelist III

Terminal? which terminal? How it is configured? Save the log/transcript and examine for control characters etc.


I am using the terminal provided by the TM Terminal CDT 11.3 extension in the STM32CubeIDE. The terminal is configured as follows:


I have also tried using an external application as a terminal (Tera Term) and encounter the same problem. 

The timer callback function triggers every 125ms (which should be plenty of time I think)

Here is a link to a video showing the problem:

Maybe i perfectly dont understand your idea use MCU to send chars to PC. I see real usage on Board with LCD , but then uart isnt required...

Back to issue , maybe your time is synced with some screen refresh times try other. And too on UARTs exist FIFOs and other buffering hw ...

Well I guessed that flickering can be caused by a "smart" terminal reacting to some ESC sequences or other control characters. This is less likely on a dumb terminal. The Eclipse add-on likely is the latter. Perhaps try a simple ascii encoding instead of UTF-8.