cancel
Showing results for 
Search instead for 
Did you mean: 

USART Idle Interrupt without RXNE

EBepp
Associate II

I am working with the STM32F767 and DMA1/USART3 for RX and TX. TX is fully functional. Currently the idle line interrupt continuously fires when enabled, while the RXNE interrupt never fires. The Idle interrupt is cleared everytime the interrupt is fired. The RX is triggered by a HAL_USART_Receive_DMA. Is there any known cause for this or required settings?

5 REPLIES 5
Jack Peacock_2
Senior III

If you are receiving with DMA enabled the RXNE interrupt should be disabled, otherwise there's no benefit in using DMA. As each byte arrives RXNE will be set and then almost immediately cleared by DMA reading the data register. The side effect of that RXNE set/reset pulse is that it also resets the IDLE timeout after each character (as it should). Assuming you are clearing the IDLE interrupt in the ICR register yet you still see a constant stream of IDLE interrupts would seem to indicate the inter-character gap between incoming characters exceeds whatever your IDLE timeout threshold is (usually 10 bit times).

The real problem is a slow transmitter. If you are trying to use IDLE to timeout the RX DMA either you need a much longer interval (RTOR register and RTOF flag, some STM32s support this, many don't) or you have to go with a hardware approach, using the RxD line as a trigger input on a timer pin to reset a timer until there's a long gap in received data, essentially the same as the RTOR/RTOF but in external connections and a TIM with a reset pin.

This is a common problem with serial lines using Modbus RTU (i.e. binary) mode. Messages are framed by gaps, typically detected by the IDLE interrupt. Part of the Modbus protocol requires a very short gap between bytes within a message, to prevent a premature IDLE interrupt in the middle of a message. This is the responsibility of the transmitter, not receiver. Check the section in the reference manual for USART Modbus communications, it applies even if you aren't using Modbus.

Short answer, everythigng is working as it's supposed to work. You have a timing problem in the rate data arrives being slower than the IDLE threshold.

Jack Peacock

EBepp
Associate II

Jack, thanks for the response - I agree that the functionality you describe is the functionality I would expect, however I am seeing the IDLE interrupt with no data on the bus ever. i.e. the program starts and the interrupt fires before any data has been transmitted to the device. The UART line remains high the entire time. This seems to be counter to the description of the functionality.

Jack, thanks for the response - I agree that the functionality you describe is the functionality I would expect, however I am seeing the IDLE interrupt with no data on the bus ever. i.e. the program starts and the interrupt fires before any data has been transmitted to the device. The UART line remains high the entire time. This seems to be counter to the description of the functionality.

Have you found the solution for this issue? I think I have the same problem with my MCU. The idle line interrupt continuously fires and I don't know how to deal with it, because I think I do everything properly according to documentation.

> I think I do everything properly according to documentation.

And that, in terms of RM/registers, is?

You may also want to check out Tilen Majerle's related work.

JW