HAL USART DMA buffer reset method?
Hi Community,
I find a method to reset a buffer of USART DMA Buffer.
because I use USART DMA basically.
my system is consist of android smartphone, bluetooth and microcontroller(STM32F407VET), PC
when I click a button that implemented in a android, some packet is send to the bluetooth RX
and Bluetooth TX that connected to micro controller USART3 RX.
than Received USART3 Data directly send to USART1 and I can see the packet in PC program.
(So... long)
I learned about HAL USART DMA is need a fixed buffer size.
so I designed the system the length of the packet is always fixed.
But! when the Bluetooth is connected, the packet is occurred by Bluetooth like
"Connected X" (X is MAC address of Bluetooth)
Due to the packet that I don't want, DMA buffer is shifted.
like under example.
ex)
Normal State
buffer size 5
send "12345" => receive "12345"
Abnormal state
send "12345" => add packet "ab"=>receive "ab123"
For this reason, I would like to ask community How to reset DMA buffer.
Of course, using a ring buffer is best way, but I'm not have a code that work normally, and other is I can't understand the code algorithms.
Ask for help...
Thank.
