Problem with LINFlexD LIN frame transmit

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

Problem with LINFlexD LIN frame transmit

1,061 Views
xinweichang
Contributor III


Below is a LIN frame transmit function, when I run it on 5748G with single step mode, it always stuck here: while(0 == LINFlexD_1.LINSR.B.DTF). Could I missed something at the initial mode?

 

 

void TransmitData(uint16_t bidr_value)

{

    /* 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 = bidr_value;

   

    /* Trigger Frame transmission */

    LINFlexD_1.LINCR2.B.HTRQ = 1;   

   

    /* 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 */

}

Labels (1)
0 Kudos
Reply
2 Replies

614 Views
martin_kovar
NXP Employee
NXP Employee

Hi,

about the code, please check this example. It shows, how to use LINFlexD module. Example is created for MPC5744P, but the modules are similar.

Example MPC5744P LIN Master Slave test GHS614

Check also SIUL2 configuration and jumper settings (SIUL2 configuration will be probably different from example above).

Regards,

Martin

0 Kudos
Reply

614 Views
xinweichang
Contributor III

I think no LIN frame was sent out after HTRQ was set

0 Kudos
Reply