MPC5748 LIN Master-Slave Communication Issue

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

MPC5748 LIN Master-Slave Communication Issue

319 Views
sjoshi33
Contributor I

I have connected LIN0 and LIN2 together. LIN0 is configured as a Slave and LIN2 is configured as a Master. I am trying to send data on LIN2 and receive it on LIN0. I am using the NXP recipe to test LIN Master-Slave communication.

I am facing issue while transmitting data over LIN2. The program gets stuck infinitely in the while(0 == LINFlexD_2.LINSR.B.DTF) used in the function below -

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;

    /* Trigger Frame transmission */
    LINFlexD_2.LINCR2.B.HTRQ = 1;

    /* wait until Master response to the LIN header has been sent successfully */
    while(0 == LINFlexD_2.LINSR.B.DTF);

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

}

 

Please advice.

0 Kudos
0 Replies