LIN init and rx interrupt function

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

LIN init and rx interrupt function

771 Views
evahe
Contributor I

hello all:

               it's my first time to do LIN communciation, I have questions about LIN INIT configuraiton.(my controller is MC9S12ZVLRM )

1. after I configure my LIN init code like this, software  will crash. here are my LIN init code.

void SCI_Init(void)

{

s_ptrSciReg->SCICR1 = SCICR1_PE_MASK |SCICR1_MSCI;    /*enable parity */  
s_ptrSciReg->SCICR2 = (SCICR2_RIE_MASK | SCICR2_TE_MASK | SCICR2_RE_MASK); 

 s_ptrSciReg->SCIBDH = 0x06u      /*bautrate is 19200*/
 s_ptrSciReg->SCIBDL = 0x83u

 s_ptrSciReg->SCISR2 = SCISR2_AMAP_MASK;  /*use the alternative register*/


 SCIRegPtr->SCIACR1 = SCIACR1_BKDIE_MASK;   /*BKDIF interrupt requests enabled*/

 SCIRegPtr->SCIACR2 = SCIACR2_BKDFE_MASK;   /*BKDIF interrupt requests enabled*/

}

my software crashed when i configure the LIN Init like above. So how to use the alternative control register ? if i only need  LIN module work as slave node, should I configure alternative control register?

2. i modified my above code to this:

void SCI_Init(void)

{

s_ptrSciReg->SCICR1 =SCICR1_M; 

s_ptrSciReg->SCICR2 = (SCICR2_RIE_MASK | SCICR2_TE_MASK | SCICR2_RE_MASK); 

 s_ptrSciReg->SCIBDH = 0x06u      /*bautrate is 19200*/
 s_ptrSciReg->SCIBDL = 0x83u

}

then my software didn't crash anymore, but when i use canoe to send out LIN message to my SCU, when the break filed was received, SCI receive states Frame Error Flag bit is true. how to deal with this? i think it's reasonable that the break data should be Error Flag. Am i right?

0 Kudos
Reply
1 Reply

606 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello Eva,

How does the software crash?

You can check the Lin Driver LIN2.x and SAE J2602 Stack.

Regards,

Daniel

0 Kudos
Reply