2024-04-08 08:54 AM
Hello,
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!
2024-04-08 09:34 AM - edited 2024-04-08 09:36 AM
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
2024-04-08 09:38 AM
Terminal? which terminal? How it is configured? Save the log/transcript and examine for control characters etc.
2024-04-08 09:46 AM
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.
2024-04-08 09:54 AM
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: https://drive.google.com/file/d/1i9BgiF-0ctilwvtYG4YLdYUUxrSliLjy/view?usp=drive_link
2024-04-08 10:17 AM
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 ...
2024-04-09 12:11 PM
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.