lpuart idle line detection takes up to 2.3ms

cancel
Showing results for 
Search instead for 
Did you mean: 

lpuart idle line detection takes up to 2.3ms

110 Views
bp1979
Contributor IV

Hi,

I am using an imx RT1020 evk board, and just found out that it takes rather long to get an idle line interrupt.

I am using LPUART3 with DMA (in 9bits mode).

bp1979_0-1635084891248.png

In the RM I read 

bp1979_1-1635085199124.png

 

So the peripheral waits for 1 full byte to be all 1s, including start and stop bit. But that would be a bit over 1ms. Right? 

 

So why is the idle line interrupt only set after 2.3ms? 

Is there a way to decrease this time?

 

Thx!

0 Kudos
2 Replies

93 Views
diego_charles
NXP TechSupport
NXP TechSupport

Hi @bp1979 

I hope that you are doing well!

The first things that come into my mind are consider :  code overhead ;  the speed  of current clock provided to the  UART peripheral ;  and the desired baud rate  . Are you taking as starting point  any of our SDK demo examples? I want to get more context on the settings that you are performing .

All the best 

Diego.

0 Kudos

87 Views
bp1979
Contributor IV

Hi @diego_charles 

Code overhead is not the case. I am simply toggling a pin in the interrupt handler so that I can plot the entry of the interrupt handler in my logic analyzer.

    void LPUART3_IRQHandler(void)
    {
        uint32_t status            = LPUART_GetStatusFlags(LPUART3);
        uint32_t enabledInterrupts = LPUART_GetEnabledInterrupts(LPUART3);

        if ((0U != ((uint32_t)kLPUART_IdleLineFlag & status)) &&
            (0U != ((uint32_t)kLPUART_IdleLineInterruptEnable & enabledInterrupts)))
        {
			GPIO1->DR ^= (1UL << 23);
			GPIO1->DR ^= (1UL << 23);

        	uartMdb.IdleLineCallback();

			GPIO1->DR ^= (1UL << 23);
			GPIO1->DR ^= (1UL << 23);
        }
    }

 

In the image I posted in my first message you can see that after the last character is received on rx (yellow), it takes up to 2.3ms to toggle the pin (blue). 

Uart initialization:

        lpuart_config_t config;
        LPUART_GetDefaultConfig(&config);
        config.rxIdleType   = kLPUART_IdleTypeStopBit;
        config.rxIdleConfig = kLPUART_IdleCharacter2;
        config.baudRate_Bps = _baudRate; // 9600 for LPUART3
        config.enableRx = _canRead; // true for LPUART3
        config.enableTx = true;

        // Initialize the uart with default config and both rx and tx enabled
        LPUART_Init(
            _instance, // LPUART3
            &config,   
            BOARD_DebugConsoleSrcFreq()); // freq = 80000000

 

I am seeing the behavior in my real application. I have no doubt it will behave identical in SDK examples. 

The idle line flag seem to wait until 2 (9bit) bytes are read as "all ones". I would expect it would only wait for 1 byte.

Any ideas why it behaves this way? 

Any idea how to influence that behavior?

Many thanks in advance!

 

 

0 Kudos