cancel
Showing results for 
Search instead for 
Did you mean: 

Ring buffer implementation does not work as intended

demir
Senior II

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.

2 REPLIES 2
Pavel A.
Evangelist III

Here is a good ring buffer code that works.

https://github.com/MaJerle/lwrb

 

Karl Yamashita
Lead II

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. 

I Can't Believe It's Not Butter. If you find my answers useful, click the accept button so that way others can see the solution.