AnsweredAssumed Answered

mpc5744 LinFlexD master Tx problem

Question asked by Jeff liu on May 16, 2017
Latest reply on May 18, 2017 by Jeff liu

Dear NXP,

I'm using LinFlexD on MCP5744 microcontroller with official EV-board.
According to sample code "Example MPC5744P LIN Master Slave test GHS614".
I have setting LinFlexD_1 as master same as sample code.

After writing data to BDRM buffer then write BIDR to trigger FlexLinD_1 to send frame but I can't find any break and sync frame signal.
There was no any signal appeared on the LA.

I have tried the PF14 and PF15 configure as UART mode and they could send data from Tx.


Please help me with this problem. Thank you.

 

 

FlexLin_1 setting as following:

//---- Initial setting ------
void Drv_LinFlexD1_init(void)
{

//-------- Pad setting --------------------

/* Configure pad PF14 for AF1 func: LIN1TX */
SIUL2.MSCR[94].R = 0; //Jeff add
SIUL2.MSCR[94].B.SSS = 1; /* Pad PF14: Source signal is LIN1_TXD */
SIUL2.MSCR[94].B.OBE = 1; /* Pad PF14: Output Buffer Enable */
SIUL2.MSCR[94].B.ODE = 1; /* Pad PF14: Output Drain Enable */
SIUL2.MSCR[94].B.PUS = 1; /* Pad PF14: Pull up selected */
SIUL2.MSCR[94].B.PUE = 1; /* Pad PF14: Pull Enable */
SIUL2.MSCR[94].B.SRC = 3; /* Pad PF14: Maximum slew rate */

/* Configure pad PF15 for LIN1RX */
SIUL2.MSCR[95].B.IBE = 1; /* Pad PF15: Enable pad for input - LIN1_RXD */
SIUL2.IMCR[166].B.SSS = 3; /* LIN1_RXD: connected to pad PF15 */

//----Lin 1 initial

/* enter INIT mode */
LINFlexD_1.LINCR1.R = 0x0081; /* SLEEP=0, INIT=1 */

/* wait for the INIT mode */
while (0x1000 != (LINFlexD_1.LINSR.R & 0xF000)) {}


/* configure baudrate 19200 */
/* assuming 100 MHz baud clock (halfsys_clk below)*/
/* LFDIV = halfsys_clk / (16 * desired baudrate)
LINIBRR = integer part of LFDIV
LINFBRR = 16 * fractional part of LFDIV (after decimal point)

for instance:
LFDIV = 100e6/(16*19200) = 325.5208
LINIBRR = 325
LINFBRR = 16*0.5298 = 8
*/
LINFlexD_1.LINFBRR.R = 8;
LINFlexD_1.LINIBRR.R = 325;

LINFlexD_1.LINCR2.R = 0x40; /* IOBE=1, Bit error resets LIN state machine */
LINFlexD_1.LINTCSR.R = 0; /* LIN timeout mode, no idle on timeout */

 

LINFlexD_1.LINCR1.R = 0x0390;
}

//---- Send data ------
void Drv_Drv_LinFlexD1_Send(void)
{
/* store the data in the message buffer BDR */
LINFlexD_1.BDRL.B.DATA0 = 'H';
LINFlexD_1.BDRL.B.DATA1 = 'e';
LINFlexD_1.BDRL.B.DATA2 = 'l';
LINFlexD_1.BDRL.B.DATA3 = 'l';

LINFlexD_1.BDRM.B.DATA4 = 'o';
LINFlexD_1.BDRM.B.DATA5 = '!';
LINFlexD_1.BDRM.B.DATA6 = '!';
LINFlexD_1.BDRM.B.DATA7 = '!';

/* Master to publish x bytes with ID and CCS from bidr_value */
LINFlexD_1.BIDR.R = 0x1E35;

/* wait until Master response to the LIN header has been sent successfully */
while(0 == LINFlexD_1.LINSR.B.DTF)
{
/* track LIN Status for errors */
}

LINFlexD_1.LINSR.R = 0x0002; /* clear the DTF bit */
}

Outcomes