[MPC5777M] UART in Loop Back mode

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

[MPC5777M] UART in Loop Back mode

1,667件の閲覧回数
umabk
Contributor III

Hello,

 

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++)
    { 

    TransmitCharacter(TransmitDataBuffer[j]);
    ReadCharacter();

    }
}

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

Please help me find where I am going wrong.

Thanks!

ラベル(1)
1 返信

1,265件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi Uma,

I have tested the same code (example from https://community.nxp.com/docs/DOC-329848) on the MPC5777M EVB in loopback mode with baudrate 5Mbit/s and it worked well.

So hard to say, check clocking and baudrate calculation. Or the module is not in loopback mode.

BR, Petr