cancel
Showing results for 
Search instead for 
Did you mean: 

Error handling for UART RX with DMA

T B
Associate II
Posted on January 15, 2018 at 11:00

Hello!

I am using RX DMA with RX timeout detection (based on Efficiently receive UART data using DMA). Under normal condition, everything works fine, but I have problems with the error handing. My MCU is the F302R8 on the NUCLEO-F302R8.

I have I test case, where I send data on the half baudrate to provoke an UART framing error on the receiver. For example, I send “0xF8, 0x00, 0xFF�? and the receiver gets “0x80, 0x00 (framing error) 0x0FE�?

0690X00000604D4QAI.jpg

Now I have two problems:

First problem: DDRE (DMA Disable on Reception Error) does not disable the DMA.

If USART_CR3_DDRE is disabled, I receive only the error free bytes ''0x80, 0x0FE''. This is as expected.

But if USART_CR3_DDRE is enabled I receive “0x80, 0x00, 0x0FE�? and the DMA is not stopped.

Here I would expect to receive only the bytes until the error and that the DMA is disabled.

Second problem: My test sometimes cause a UART Timeout and sometimes not.

Strangely if the UART error interrupt is enabled, then the UART Timeout is set after each block of bytes. (In the ISR I only increasing a counter and clear the framing error.)

Without UART error interrupt not each block of bytes causes a UART Timeout.
1 REPLY 1

Sorry, bumping old zombie unanswered questions off my feed

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..