AnsweredAssumed Answered

[MPC5777M] UART in Loop Back mode

Question asked by Uma Balakrishnan on Jan 12, 2017
Latest reply on Jan 13, 2017 by Petr Stancik



I'm trying to run UART in Loop Back mode on an MPC5777M evaluation board. I have UART working properly in normal mode, but I want to use higher baud rates (>3 Mbits/s) and thought that the loop back would be a good way to test it.


I set the LBKM bit in LINCR1 in INIT mode and make other configurations as I did with regular UART. I use the following functions:


void TransmitCharacter(uint8_t ch)
    // address of LINFLEX_0.BDRL.B.DATA0
    unsigned char *pTX =  (unsigned char *)&LINFlexD_2.BDRL.R + 3;

    *pTX = ch;    /* write character to transmit buffer */
    while (1 != LINFlexD_2.UARTSR.B.DTFTFF) {}; /* Wait for data transmission completed flag */
    LINFlexD_2.UARTSR.R = 0x0002;             /* clear the DTF flag and not the other flags */  


void ReadCharacter (void)

    while (1 != LINFlexD_2.UARTSR.B.DRFRFE) {}  /* Wait for data reception completed flag */

    while (1 != LINFlexD_2.UARTSR.B.RMB) {}  /* Wait for Release Message Buffer */
    rx_data = (uint8_t)LINFlexD_2.BDRM.B.DATA4; /* get the data */
    /* clear the DRF and RMB flags by writing 1 to them */
    LINFlexD_2.UARTSR.R = 0x0204;        


void uart_loopback(uint8_t TransmitDataBuffer, uint32_t txSize)
    int j = 0;
    for (j=0; j< txSize; j++)



The transmit part is happening fine but receive does not happen at all.

Please help me find where I am going wrong.