LIN Master-Slave Communication Issue for MPC5748G

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LIN Master-Slave Communication Issue for MPC5748G

491 Views
sjoshi33
Contributor I

Hi,

I am testing LIN Master-Slave Communication over MPC5748. I am using LINFlexD_0 as Slave and LINFlexD_2 as Master. Schematic for LIN transceiver is attached. (Note – Jumper J1 is not used)
I am using example code from - https://community.nxp.com/t5/MPC5xxx-Knowledge-Base/Example-MPC5748G-LINFlex-LIN-Master-Slave-test-G...
I observe that the program is infinitely stuck in the while(0 == LINFlexD_2.LINSR.B.DTF) of below function.

void TransmitData(uint16_t bidr_value)
{
    /* store the data in the message buffer BDR */
    LINFlexD_2.BDRL.B.DATA0 = 'H';
    LINFlexD_2.BDRL.B.DATA1 = 'e';
    LINFlexD_2.BDRL.B.DATA2 = 'l';
    LINFlexD_2.BDRL.B.DATA3 = 'l';

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

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

    /* Request header transmission */
    LINFlexD_2.LINCR2.B.HTRQ = 1;

    /* Wait for data transfer complete flag */
    while(0 == LINFlexD_2.LINSR.B.DTF);

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

Please advise.

Regards,
Shantanu Joshi

0 Kudos
1 Reply

424 Views
jnaulet
Contributor I

It's a little late but i think you forgot to configure BIDR DIR & DFL fields

0 Kudos