AnsweredAssumed Answered

S32K SDK RTM 3.0.0 LIN / VLPS: safe to stop?

Question asked by Nathan Hellwig on Dec 20, 2019
Latest reply on Jan 17, 2020 by Nathan Hellwig

I have LIN working with the S32K EVB using the SDK per the example code.


However, in my implementation, I must sleep my MCU whenever possible, and I need to use VLPS to reduce power consumption as much as possible.


As such, I use the LPTMR to wake the MCU periodically from VLPS (if no external interrupts are triggered, i.e. LIN wakeup or other IRQs), and altered the LIN autobaud code to use the LPIT instead (the LPIT does not run in VLPS).


My problem is that I don't know when it is safe to sleep, i.e. when the LIN stack is not processing frame data.


I attempted to use this logic to see if LIN was "busy":




However, linState is IDLE in the middle of frame processing.  


As such, I tell the MCU to enter VLPS in the middle of a transmission, LPIT stops, and the MCU fails to properly sync and communicate with the LIN bus.


With the SDK, what indicators do I have that there is no active LIN communication in progress and it is safe to sleep?


Note that I cannot use the LPTMR for both LIN and auto-wake because I'm sleeping up to 2 seconds between wakeups, and the LIN stack expects a "timeout" of 500us with the timer.