This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM2634: Configure UART idle-line interrupt

Part Number: AM2634

Hello.

I have configured an UART peripheral to receive data through DMA, on a Sitara MCU (AM2634-CC evaluation board).

The DMA is configured to receive data from the UART and write it into a circular buffer. The size of the data is not known beforehand, so I would like to use the idle-line interrupt to generate an UART interrupt once there is silence on the line (A full message has been received and it's ready to be processed).

I have not found any Idle-line interrupt in AM263_RA manual. I have looked at MSS_UARTn_IER and MSS_UARTn_IER2.

Something close to the idle-line interrupt seemed to me the RHR RX timeout, but it seems it cannot be used in my case (I think it's usage is when UART FIFO is used, and there is some data staled in the RX_FIFO).

Update: I tried to set the UARTn_TIMEOUT register, enabled the RHR_IT. (I'm using DMA mode 1, RX FIFO granularity 1, UARTx_TLR->RX_FIFO_TRIG_DMA = 0)

- The expected behaviour would be: I send a frame of 4 bytes to the UART, the DMA copies that and then the UART issues an RX Timeout interrupt (UART_IIR_UART IT_TYPE value 6) after the bytes are received

- What I actually get is that DMA copies the 4 bytes, but UART generates an interrupt for every byte sent (4 interrupts) and during those interrupts the IT_TYPE is 0, so no interrupt pending.

Eventually I tried to do the same test, also setting the UART_IER2->RHR_IT_DIS (From RA it says it "disables the RHR interrupt") and UART_IER->RHR_IT = 1 (From RA it says it "enables RHR interrupt and timeout interrupt") So such condition would lead only the RX Interrupt to remain enabled. But I just do not get any interrupt in that situation.

Does UART support Idle-line interrupt ? How can I enable/configure it ?

  • Hi Fillippo,

    Have you tried to use the Time-Our Counter:

    1.4.4.8.1.5.7.1 Time-Out Counter
    An RX idle condition is detected when the receiver line (RX) is high for a time that equals 4x the programmed
    word length + 12 bits or manually configured amount of baud clocks, if a value other zero is set in the timeout
    register. RX is sampled midway through each bit.

    Best regards,

    Ming

  • Hi, Thanks for the reply. Yes I have already tried to use that counter.

    I have tried already to use it as UART_EFR2[6]->TIMEOUT_BEHAVE = 0 and I do not get any RX Timeout interrupts. While UART_EFR2[6]->TIMEOUT_BEHAVE = 1 I get the periodic interrupts but it does not fit the needed use-case, as the interrupt should be triggered only when a message is received.

  • Hi Fillippo,

    What value did you set in the timeout register? What is your UART baud rate? It sounds like your timeout counter was set too small.

    Best regards,

    Ming

  • Hi,

    I have tried to set i.e. TIMEOUTH = 0x80. The current baudrate I am using for testing purposes is a standard 115200.

  • Hi Filippo,

    According to AM263x TRM:

    When UART_EFR2[6]->TIMEOUT_BEHAVE = 0, there has to be at least one character in the RX FIFO for the counter to count, if you use DMA to move the data from RX FIFO to memory, then there will be no data in RX FIFO after each DMA operation. That is why you never get any RX timeout interrupt. Can you try to use the CPU to move the data out of RX FIFO and always leave one character in RX FIFO?

    Bets regards,

    Ming

  • Hi, thank you for the reply. This brings me back to my original question:
    Does Sitara AM263x UART support Idle-line interrupt? 
    (Using CPU to move data out from the RX FIFO is not an option when using a high baudrate)

  • Hi Filippo,

    According to the TRM, I do not think AM263x UART has the direct support of what you are looking for (Idle-line interrupt while using DMA).

    Best regards,

    Ming