I want to use the MPC5603P LINFlex interrupt

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

I want to use the MPC5603P LINFlex interrupt

604件の閲覧回数
mkk_lee
Contributor I

I used this example

https://community.nxp.com/t5/MPC5xxx-Knowledge-Base/Example-MPC5604B-LINFlex-LIN-Master-Slave-commun...

 

I want to use LIN interrupts, is there an example I can refer to?

 

and during the example test

-----------------------------------------------------------------

static void LIN0_ReceiveData(uint16_t bidr_value)
{

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

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

/* wait until Slave response to the LIN header has been receive successfully */
while(0 == LINFLEX_0.LINSR.B.DRF)
{
/* track LIN Status for errors */

// stop here

}

/* read BDR registers */
rx_data[0] = LINFLEX_0.BDRL.B.DATA0;
rx_data[1] = LINFLEX_0.BDRL.B.DATA1;
rx_data[2] = LINFLEX_0.BDRL.B.DATA2;
rx_data[3] = LINFLEX_0.BDRL.B.DATA3;
rx_data[4] = LINFLEX_0.BDRM.B.DATA4;
rx_data[5] = LINFLEX_0.BDRM.B.DATA5;
rx_data[6] = LINFLEX_0.BDRM.B.DATA6;
rx_data[7] = LINFLEX_0.BDRM.B.DATA7;

/* clear RMB, HRF, DRF and DTF flags */
LINFLEX_0.LINSR.R = 0x0207;

}

------------------------------------------------------------

When data is received it works fine, but when no data is received it stops at the while statement. Is there any way to solve this?

please help thank you

0 件の賞賛
返信
1 返信

594件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

Slave example enables TX and RX interrupt, so you can refer to it. In master mode if node publish data, TX interrupt (DTF flag) will be called after node transmit frame. If node request data, then RX interrupt (DRF flag) will be called after response is received.
Timeout counter can be used to detect no response (frame timeout), see more in chapter 21.8.3 8-bit timeout counter of the RM. 

BR, Petr