The application development of LIN communication in I2C peripherals

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

The application development of LIN communication in I2C peripherals

720 Views
benjieming
Contributor I

Hi everyone:
   During the application of the KEAZN32 single-chip microcontroller based on LIN communication and I2C host interrupt peripheral, I encountered problems such as abnormal LIN communication when calling the I2C interrupt in the program, and the UART1 interrupt used also failed. The engineering development environment I am using is the S32DS platform and the official FRDM-KEA-QSP driver library. Regarding the issues mentioned above, I sincerely hope for the support of all technical experts.
   Thank you very much.

Labels (1)
0 Kudos
Reply
1 Reply

631 Views
Celeste_Liu
NXP Employee
NXP Employee

Hello @benjieming ,

Thanks for your post.

Have you ever referred to our LIN2.x stack for KEA:

https://www.nxp.com/webapp/swlicensing/sso/downloadSoftware.sp?catid=SW-LIN2X-J2602-D

 

In addition, based on your description, I suspect the issue may be related to the following points:


1. TheISR name does not match the vector table in the startup file.
This is especially common when porting the LIN_Stack to S32DS, you usually need to rename the UART1 ISR in lin_isr.c so that it matches the vector name defined in startup_*.s.
If the names don’t match, the UART1 interrupt will never be triggered.


2. Improper interrupt priority configuration or excessive use of global interrupt masking.
If the I2C interrupt has a higher priority, runs for too long, or global interrupts are disabled in certain critical sections, the UART1 interrupt used by LIN may be blocked for an extended period.
As a result, LIN may miss critical timing windows such as Break, Sync, and Response.
Therefore, UART1/LIN should be assigned a higher priority than I2C, and all ISRs must remain as short as possible.


3. Incorrect flag‑clearing sequence or register access order.
For example, UART requires reading UARTx_S1 before reading/writing the D register in order to clear RDRF/TDRE correctly.
If the order is wrong, the system may exhibit the classic symptom of “the ISR fires once and never fires again.”
The I2C module also requires flags to be cleared strictly in the sequence specified by the reference manual.


Additionally, others have performed similar migrations and have shared their experience.
I have found a useful reference link for you to review.

如何使用S32DS开发KEA系列的LIN功能(二)_nxp kea lin协议栈生成-CSDN博客

BR

Celeste

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2296253%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EThe%20application%20development%20of%20LIN%20communication%20in%20I2C%20peripherals%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2296253%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20everyone%3A%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3BDuring%20the%20application%20of%20the%20KEAZN32%20single-chip%20microcontroller%20based%20on%20LIN%20communication%20and%20I2C%20host%20interrupt%20peripheral%2C%20I%20encountered%20problems%20such%20as%20abnormal%20LIN%20communication%20when%20calling%20the%20I2C%20interrupt%20in%20the%20program%2C%20and%20the%20UART1%20interrupt%20used%20also%20failed.%20The%20engineering%20development%20environment%20I%20am%20using%20is%20the%20S32DS%20platform%20and%20the%20official%20FRDM-KEA-QSP%20driver%20library.%20Regarding%20the%20issues%20mentioned%20above%2C%20I%20sincerely%20hope%20for%20the%20support%20of%20all%20technical%20experts.%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3BThank%20you%20very%20much.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2296253%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3EKinetis%20EA%20Series%20MCUs%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2298131%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20The%20application%20development%20of%20LIN%20communication%20in%20I2C%20peripherals%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2298131%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F258918%22%20target%3D%22_blank%22%3E%40benjieming%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%0A%3CP%3EThanks%20for%20your%20post.%3C%2FP%3E%0A%3CP%3EHave%20you%20ever%20referred%20to%20our%20LIN2.x%20stack%20for%20KEA%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwww.nxp.com%2Fwebapp%2Fswlicensing%2Fsso%2FdownloadSoftware.sp%3Fcatid%3DSW-LIN2X-J2602-D%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.nxp.com%2Fwebapp%2Fswlicensing%2Fsso%2FdownloadSoftware.sp%3Fcatid%3DSW-LIN2X-J2602-D%3C%2FA%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EIn%20addition%2C%20based%20on%20your%20description%2C%20I%20suspect%20the%20issue%20may%20be%20related%20to%20the%20following%20points%3A%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3E1.%20TheISR%20name%20does%20not%20match%20the%20vector%20table%20in%20the%20startup%20file.%3CBR%20%2F%3EThis%20is%20especially%20common%20when%20porting%20the%20LIN_Stack%20to%20S32DS%2C%20you%20usually%20need%20to%20rename%20the%20UART1%20ISR%20in%20lin_isr.c%20so%20that%20it%20matches%20the%20vector%20name%20defined%20in%20startup_*.s.%3CBR%20%2F%3EIf%20the%20names%20don%E2%80%99t%20match%2C%20the%20UART1%20interrupt%20will%20never%20be%20triggered.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3E2.%20Improper%20interrupt%20priority%20configuration%20or%20excessive%20use%20of%20global%20interrupt%20masking.%3CBR%20%2F%3EIf%20the%20I2C%20interrupt%20has%20a%20higher%20priority%2C%20runs%20for%20too%20long%2C%20or%20global%20interrupts%20are%20disabled%20in%20certain%20critical%20sections%2C%20the%20UART1%20interrupt%20used%20by%20LIN%20may%20be%20blocked%20for%20an%20extended%20period.%3CBR%20%2F%3EAs%20a%20result%2C%20LIN%20may%20miss%20critical%20timing%20windows%20such%20as%20Break%2C%20Sync%2C%20and%20Response.%3CBR%20%2F%3ETherefore%2C%20UART1%2FLIN%20should%20be%20assigned%20a%20higher%20priority%20than%20I2C%2C%20and%20all%20ISRs%20must%20remain%20as%20short%20as%20possible.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3E3.%20Incorrect%20flag%E2%80%91clearing%20sequence%20or%20register%20access%20order.%3CBR%20%2F%3EFor%20example%2C%20UART%20requires%20reading%20UARTx_S1%20before%20reading%2Fwriting%20the%20D%20register%20in%20order%20to%20clear%20RDRF%2FTDRE%20correctly.%3CBR%20%2F%3EIf%20the%20order%20is%20wrong%2C%20the%20system%20may%20exhibit%20the%20classic%20symptom%20of%20%E2%80%9Cthe%20ISR%20fires%20once%20and%20never%20fires%20again.%E2%80%9D%3CBR%20%2F%3EThe%20I2C%20module%20also%20requires%20flags%20to%20be%20cleared%20strictly%20in%20the%20sequence%20specified%20by%20the%20reference%20manual.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EAdditionally%2C%20others%20have%20performed%20similar%20migrations%20and%20have%20shared%20their%20experience.%3CBR%20%2F%3EI%20have%20found%20a%20useful%20reference%20link%20for%20you%20to%20review.%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fblog.csdn.net%2Fbjxdbz%2Farticle%2Fdetails%2F120120302%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8S32DS%E5%BC%80%E5%8F%91KEA%E7%B3%BB%E5%88%97%E7%9A%84LIN%E5%8A%9F%E8%83%BD%EF%BC%88%E4%BA%8C%EF%BC%89_nxp%20kea%20lin%E5%8D%8F%E8%AE%AE%E6%A0%88%E7%94%9F%E6%88%90-CSDN%E5%8D%9A%E5%AE%A2%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EBR%3C%2FP%3E%0A%3CP%3ECeleste%3C%2FP%3E%3C%2FLINGO-BODY%3E