cancel
Showing results for 
Search instead for 
Did you mean: 

Uart DMA RX problem

SGian.1
Senior

Hi there !

I use uart with DMA for receive data from (right now) pc and STM32F051 discovery board, everythingh work bettere if i send all data, but if i send less data stop the work . Let me explain i need the send 180 bytes from pc to discovery board , i know i can have two interrupt one for HC (half comunication)e the other for TC(total comunications) but if i send 4 byte i diden't receive any interrupt, but the problem is the pointer of the counter don't start from 0 to put the data inside the buffer (configurarte in circular mode) but start from the 5 position. Some one have any idea how i can fix this problem ?

Thank you soo much

Sergio

2 REPLIES 2
TDK
Guru

HAL_UART_Receive_DMA requires a fixed length to receive. If yours is variable, you can abort the transfer and restart it. Or if you're in circular mode, just treat the buffer as a FIFO and pop/process bytes as they come in.

If you feel a post has answered your question, please click "Accept as Solution".
SGian.1
Senior

Thanks for your fast replace , my data have all the same size , i send 4 byte just for simulate if there is one rx error and how i can fixed