Skip to main content
SGian.1
Associate III
Aug 29, 2020 2:24 PM UTC
Question

Uart DMA RX problem

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

This topic has been closed for replies.

2 replies

TDK
Aug 29, 2020 2:46 PM UTC

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
SGian.1Author
Associate III
Aug 29, 2020 2:55 PM UTC

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