Problem with LINFlexD LIN frame transmit

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Problem with LINFlexD LIN frame transmit

1,094 次查看
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 */

}

标签 (1)
0 项奖励
回复
2 回复数

647 次查看
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 项奖励
回复

647 次查看
xinweichang
Contributor III

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

0 项奖励
回复