MPC5744P LinFlex UART is very slow & possible fix

cancel
Showing results for 
Search instead for 
Did you mean: 

MPC5744P LinFlex UART is very slow & possible fix

453 Views
markusransberge
Contributor III

Hello,

I just want to tell you that the LinFlex UART implementation is almost unusable slow. It takes around 250ms to transmit a hard-coded string of just 16 characters. That's 15.625ms per character. Can somebody please look into it for the next version?

So I went ahead and implemented the code of one of your C examples and voilà it actually takes around 2.2ms now to transmit about 20 characters.

In linflexd_pnt_library.c I replaced the "void linflexd_pnt_TxMsg(...)" function with the following:

void linflexd_pnt_TxMsg(uint8_t linflexd_unit, uint8_t *u8TxData,
        uint32_t u32Size) {
            
    uint8_t    j = 0; // Dummy variable

    for( j=0; j < u32Size; j++ )
    {

        // Loop for character string  
        LINFlexD[linflexd_unit]->BDRL.B.DATA0 = *(u8TxData+j);
        //write character to transmit buffer
        while (1 != LINFlexD[linflexd_unit]->UARTSR.B.DTFTFF) {}
        // Wait for data transmission completed flag
        LINFlexD[linflexd_unit]->UARTSR.R = 0x0002;
        // clear the DTF flag and not the other flags
    }

}

Since in the old function there is this code in it:

//       u32Cnt = 100000;
//       while ((UART_TX_FLAG == 0) && (u32Cnt > 0))/* Wait for Data to get transmitted */
//        { u32Cnt--; }

And this takes ages to complete.

Also in the "mbdtargetmainlibpnt.tlc" file, in the "void linflex_init_fnc(void)" function I commented out all of the timeout counter and output compare writes to the registers, but I did not test if this is necessary. (Now it's almost identical to the UART C example.)

Thank you again.

Best regards,

Markus Ransberger

Tags (3)
1 Reply

97 Views
constantinrazva
NXP Employee
NXP Employee

Hi markusransberger‌,

I must thank you again for your interest!

I opened a feature request internally (AST-873) and we will take a look and fix this in our next release for MPC5774P.

Best regards,

Razvan.