AnsweredAssumed Answered

STM32F303 - USART.RXNE behaviour when using RX DMA

Question asked by benet.raul on Jul 15, 2014
Latest reply on Jul 15, 2014 by Wood.Robert
Hi,
I am currently implementing a USART rx driver on an STM32F303xxx using a receive DMA buffer. The motivation to use DMA is to allow reception of bursty high speed (8Mbps) data. [note that using HW flow control doesn't help in this case, due to the latency on the other end to react to those signals, which is several bytes]

Things seem to be working fine, but I am not sure the design is rock solid.

My uncertainty comes from the fact that it is not clear to me what is the behaviour of RXNE when doing RX DMA.  
When data is received, I do get a USART2 interrupt, but most of the time, by the time I check RXNE, it is cleared (or was it ever set ?). I am second-guessing that RXNE goes high when receiving the byte, so the CPU enter interrupts, but by the time my ISR executes, the DMA-transfer has lead to RXNE being cleared. Can anybody confirm/deny this ?

If this is the case, how can I guarantee that I will not end-up with stale data in my DMA buffer ? (other than by polling it at regular intervals....)


Thx,
Raul.

Outcomes