F29H859TU-Q1: UART RX timeout demo

Part Number: F29H859TU-Q1
Other Parts Discussed in Thread: F29-SDK, SYSCONFIG

Hi team,

My customer want to use UART and DMA to realize below function:

they need to receive the date frame(less than 64 byte) through UART, and if no new byte date receive in 2ms(it indicates that this data frame receive is complete), and it needs to trigger DMA and move the data from UART RX buffer to the target address.

Could you help to check how to realize it? and give us a demo about this?

I find the link:  https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1220244/faq-uart-rx-ms-level-timeout-realization-based-on-event-for-mspm0

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/571886/f28377-sci-rx-fifo-interrupt-timeout/2107291

BRs

Shuqing

 

 

  • Hi Shuqing,

    I recommend they take a look at the UART/DMA example in F29 SDK path: [F29-SDK install]/examples/driverlib/single_core/uart/uart_ex3_loopback_dma. This uses UART to trigger the DMA based on the RX FIFO level setting.

    If the amount of received data is not known, I suggest having the DMA transfer the minimum number of bytes they know will be received, then transfer the rest using the CPU inside the RTOUT ISR. The CPU can read data until the RX FIFO is empty. For the RTOUT interrupt, it cannot be programmed to 2ms, the only options we have is for the interrupt to be raised when a byte sits in the RX FIFO for either a 32-bit period or a 64-bit period (see below).  Let me know if they have any questions about this approach.

    Best Regards,

    Delaney

  • Hi Delaney,

    Have the problem about UART timeout length:

    If HSE is 1, that means UART clock = system clock/8, and timeout length = 2^64 * UART clock

    If HSE is 0, that means UART clock = system clock/16, and timeout length = 2^32 * UART clock

    Is it right?

    BRs

    Shuqing

  • Hi Shuqing,

    It would be the below:

    If HSE is 1, that means UART clock = system clock/8 [CORRECT], and timeout length = 64 * (1 / configured baud rate)

    If HSE is 0, that means UART clock = system clock/16 [CORRECT], and timeout length = 32 * (1 / configured baud rate)

    For example, if HSE=1, SYSCLK is 200MHz, and baud rate is set to 9600bps in the IBRD and FBRD registers:

    RTOUT timeout length = 64 * (1 / 9600 bits/second) = 64 * (0.000104 seconds/bit) = 6.667 ms

    Best Regards,

    Delaney

  • Hi Delaney,

    Tnanks for your reply!

    I enable the timeout interrupt, and enable the register interrupt handler.

    But I have below questions

    1.Is just timeout will enter the ISR or transmit/receive interrupt will also enter the ISR?

    2. How to choose the transmit interrupt as transmit RTDMA trigger source and receive interrupt as receive RTDMA trigger?

    What I want should be: min receive frames will receive transmit interrupt and it will trigger RTDMA transmission(not enter the ISR), and then timeout interrupt will enter the ISR,

    BRs

    Shuqing

  • Hi Shuqing,

    1.Is just timeout will enter the ISR or transmit/receive interrupt will also enter the ISR?

    Yes. for the UART module, there is only one interrupt line going to (each) CPU. So, only one ISR would be used for all interrupt conditions that are enabled by the IMASK register. You can check which interrupts are flagged with the MIS register - or use UART_getInterruptStatus(UART_BASE, true);

    2. How to choose the transmit interrupt as transmit RTDMA trigger source and receive interrupt as receive RTDMA trigger?

    This is done automatically by Sysconfig when you check the "Use DMA for Receive" and "Use DMA for Transmit" options. 

    What I want should be: min receive frames will receive transmit interrupt and it will trigger RTDMA transmission(not enter the ISR), and then timeout interrupt will enter the ISR,

    If you don't want the TX and RX FIFO level conditions to trigger an interrupt (only to trigger the DMA), you should disable them in the "Enabled Interrupts" dropdown. These don't need to be enabled to get a DMA trigger.

    Thanks,

    Delaney