Timeout on usart2 with DMA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-02 2:50 AM
Hi everybody,
I'm using a STM32L476RG. I use the usart2 to transmit/receive frames from an external sensor. The reception is working with DMA1 channel6 (I use Transfer complete and idle line interrupts), and it works very well.
I'd like to add a timeout to prevent the non reception of a frame.
My sensor is supplied in 12V and microcontroller is asking it ervery 0.5s. Sensor responds directly.
To simulate a broken sensor, I just unplug it from supply, so microcontroller doesn't receive any frame. When I plug again my sensor, I can see that the sensor is responding (on a terminal (docklight)) but not my microcontroller.
By checking registers, I see that idle line IT is generated but no TC interrupt. I see, also that my DMA buffer doesn't receive any character (as it was blocked). I tried to reset DMA, flag IT, and nothing happens.
Have you some ideas to help me on this point ?
Fabrice
- Labels:
-
DMA
-
STM32L4 Series
-
UART-USART
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-02 4:25 AM
Handle UART errors, particularly overflow.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-03 6:03 AM
Effectively, overrun flag is set. I'll check that and let you inform.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-03 7:46 AM
Thank you for the documentation, it seems to be what happen.
I've try to detect overrun error and read RDR buffer to clear IT flag, but it's the same, it doesn't start again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-03 7:57 AM
by making a reset of DMA/UART, it works but it's a weird method.
