Ring buffer implementation does not work as intended
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-03-06 12:08 AM
Hi all,
I am trying to implement ring buffer for my board that is STM32F407VG-DISC1. I have found out a tutorial and followed each and every step. However, when I transmitted message via serial console tool (hercules), I dont receive any data in Rx Buffer.
In the first snapshot attached, I can observe that Uart_sendstring function is working as I can see on the console (Hercules) "send string works".
However, when I send 11111 it is not received, therefore rxbuffer is empty as can be seen in the second snapshot and also uart_write function is not run, as "if(IsDataAvailable())" returns "0".
Could you please help me with this ?
You can see the repo here.
- Labels:
-
STM32CubeIDE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-03-06 2:25 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-03-06 3:57 PM
Check this git project https://github.com/karlyamashita/Nucleo-G431RB_Three_UART/wiki
It uses HAL_UARTEx_ReceiveToIdle_DMA so it'll interrupt on packets of data/messages instead of interrupting on each byte. Less overhead if you can use the DMA to do all the work while the STM32 if free to do other tasks. It uses a data structure so you can easily define multiple UART ports.
The problem with the repo link you provided is that is was designed for 1 UART/buffer so would have to be modified if you wanted to add more UART ports.
TimerCallback tutorial! | UART and DMA Idle tutorial!
If you find my solution useful, please click the Accept as Solution so others see the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-04-09 3:02 PM
Hi thanka for sharing
can the code you gave work with FreeRtos?
And if yes, it would be great if you can say what main changes need to be done.
