AnsweredAssumed Answered

Need help with UART on MPC5748

Question asked by Shijia Guo on Aug 22, 2016
Latest reply on Aug 24, 2016 by Shijia Guo

I'm trying to test out the UART periphral on MPC5748G, but I’m stuck at where I’m trying to write data into the BDRL data buffer, while the UART is configured as FIFO mode.

 

Here are my initialization code:

 

void UART_init()

{

    LINFlexD_0.LINCR1.B.SLEEP = 0;  /* Clear Sleep bit */

    LINFlexD_0.LINCR1.B.INIT = 1;   /* Enter INIT mode */

    LINFlexD_0.UARTCR.B.UART = 1;   /* Enable UART mode */

    LINFlexD_0.UARTCR.B.RFBM = 1;   /* Rx FIFO mode */

    LINFlexD_0.UARTCR.B.TFBM = 1;   /* Tx FIFO mode */

LINFlexD_0.LINCR1.B.INIT = 0;   /* Leave INIT mode */

}

 

Here’s the write function:

 

void UART_tranceive(void)

{

    LINFlexD_0.UARTCR.B.TxEn = 1;

LINFlexD_0.BDRL.B.DATA0 = (uint8_t)0x08;

}

 

Every time this is run: LINFlexD_0.BDRL.B.DATA0 = (uint8_t)0x08, there’s the critical exception generated.

 

Can anyone tell me if I’m doing something wrong?

 

Also does anyone happen to have some sample code of UART? If it’s with DMA that would be even better. Thank you so much!

 

-Shijia

Outcomes