Hello,
I have encountered a problem with sending the lin frame in mpc5748g.
I want to send the lin msg in linflex0,3,4,5. I have already tested the firmware on the mpc5848g devkit, it can send the lin msg perfectly and I can read the lin msg in the third party software(PLIN) also in the oscilloscope. The waveform is shown below.
But when I use the identical firmware in the mpc5748g's product board, the lin msg doesn't work and the waveform is shown below. I believe that only the break field stays the same but the sync field and the rest are missing.
I'll post the related code here.
void initLINFlexD_0 (void) { /* Master at 10.417K baud with 80MHz LIN_CLK */
MPC_LINFlexD_0.LINCR1.B.SLEEP = 0; /* Put LINFlex hardware in init mode */
MPC_LINFlexD_0.LINCR1.B.INIT = 1; /* Put LINFlex hardware in init mode */
MPC_LINFlexD_0.LINCR1.B.MME = 1; /* LIN master */
MPC_LINFlexD_0.LINCR1.B.MBL = 0b0011; /* master break length */
// MPC_LINFlexD_0.LINCR1.B.RBLM = 1; /* Loopback on */
MPC_LINFlexD_0.LINCR1.R= 0x00000311; /* Configure module as LIN master & header 1100010001 */
MPC_LINFlexD_0.LINIBRR.B.IBR= 260; /* Mantissa baud rate divider component */
MPC_LINFlexD_0.LINFBRR.B.FBR = 0; /* Fraction baud rate divider component */
MPC_LINFlexD_0.LINCR1.R= 0x00000310; /* end init enter normal mode */
MPC_SIUL2.MSCR[PB2].B.SSS = 1; /* Pad PB2: Source signal is LIN0_TX */
MPC_SIUL2.MSCR[PB2].B.OBE = 1; /* Pad PB2: OBE=1. */
MPC_SIUL2.MSCR[PB2].B.src=3; /* Pad PB2: Full strength slew rate */
MPC_SIUL2.MSCR[PB3].B.IBE = 1; /* Pad PB3: Enable pad for input */
MPC_SIUL2.IMCR[200].B.SSS = 2; /* LIN0_RX : connected to pad PC6 */
void lin_send_frame(uint8_t instance)
{
for(unsigned short int j = 0;j<10;j++){
memset(&(MPC_LINFlexD_0.BDRM.R),j*16+j,4);
memset(&(MPC_LINFlexD_0.BDRL.R),j*16+j,4);
MPC_LINFlexD_0.BIDR.R = 0x00001E00; /* Init header: ID=0x0, 8 B, Tx, enh cksumdfl(Number of data bytes - 1) 111 dir(tx from bdr) 1 ccs 0 reserved 00 identifier 110101*/
MPC_LINFlexD_0.LINCR2.B.HTRQ = 1; /* Request header transmission */
while (!MPC_LINFlexD_0.LINSR.B.DTF); /* Wait for data transfer complete flag */
MPC_LINFlexD_0.LINSR.R = 0x00000002; /* Clear DTF flag */
}
Could anyone give some hints where went wrong?
Best regards.