2022-11-02 02: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
2022-11-02 04:25 AM
Handle UART errors, particularly overflow.
JW
2022-11-03 06:03 AM
Effectively, overrun flag is set. I'll check that and let you inform.
2022-11-03 07: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.
2022-11-03 07:57 AM
by making a reset of DMA/UART, it works but it's a weird method.