Hi,
I'm using LinFlexD on MPC5744P EV-board.
Configured MPC5744P as Master and flased S32 design studio LIN Master code, Different controller as slave and will respond to the ID added in the filter (ID=0x30,DATA=0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00) and I connected PLIN Viewer to view LIN frame.
Master Sending 0x30h Identifier to receive data from slave. I'm able to viewe the slave response data in PLIN viewer. But MPC5744P waiting in a while loop while (!LINFlexD_0.LINSR.B.DRF); /* Wait for data receive complete flag */. DRF is not triggered and BDRL, BDRM not updated. it's value remainds 0.
//LIN init
void initLINFlexD_0 (void) { /* Master at 20K baud with 80MHz LIN_CLK */
LINFlexD_0.LINCR1.B.INIT = 1; /* Put LINFlex hardware in init mode */
LINFlexD_0.LINCR1.R = 0x000003B1; /* Configure module as LIN master & loopback mode and BF=1
LINFlexD_0.LINIBRR.B.IBR= 250; /* Mantissa baud rate divider component */
/* Baud rate divider = 80 MHz LIN_CLK input / (16*20000 bps) ~=250 */
LINFlexD_0.LINFBRR.B.FBR = 0; /* Fraction baud rate divider comonent */
LINFlexD_0.LINCR1.R = 0x000003B0; /* Change module mode from init to normal */
/* Configure LINFlexD_0 TxD Pin. */
SIUL2.MSCR[PB2].B.SSS = 0b0001; //Pad PF14: Set to LINFlex_1 TxD. Must choose this option because F14 leads to LIN PHY of motherboard
SIUL2.MSCR[PB2].B.OBE = 1; //Enable output buffer
SIUL2.MSCR[PB2].B.src=3; //Full drive-strength without slew rate control
/* Configure LINFlexD_0 RxD Pin. */
SIUL2.MSCR[PB3].B.IBE = 1; //Pad PF15: Enable input buffer
SIUL2.IMCR[165].B.SSS = 0b0001; //Connect LINFlexD_2 signal to PF15
}
//Receive fun
void receiveLINframe_0 (void) { /* Request data from ID 0x30 */
uint8_t i;
LINFlexD_0.BIDR.R = 0x00001D30; /* Init header: ID=0x15, 8 B, Rx, classic cksum */
LINFlexD_0.LINCR2.B.HTRQ = 1; /* Request header transmission */
while (!LINFlexD_0.LINSR.B.DRF); /* Wait for data receive complete flag */
/* Code waits here if no slave response */
for (i=0; i<4;i++){ /* If received less than or equal 4 data bytes */
RxBuffer[i]= (LINFlexD_0.BDRL.R>>(i*8)); /* Fill buffer in reverse order */
}
for (i=4; i<8;i++){ /* If received more than 4 data bytes: */
RxBuffer[i]= (LINFlexD_0.BDRM.R>>((i-4)*8)); /* Fill rest in reverse order */
if(RxBuffer[i]){}
}
LINFlexD_0.LINSR.R = 0x00000204; /* Clear DRF flag */
}
Register value:
Slave responce capure in PLIN Viewer:
Is there have Mater coding procedure to reference?
Please help me with this problem. Thank you.
Regards
Vennila