AnsweredAssumed Answered

S12ZVL Lin Wake up from stop mode

Question asked by Alexis Hernandez on Jun 13, 2018
Latest reply on Jun 15, 2018 by Daniel Martynek

Hi community,
I've been trying to wake up the S12ZVL64 through LIN interface with really odd behaviours.
The module is able to wake up by the API and then it can return to stop mode without problems (because of this the logic of the non-Lin related code should be correct).
At this moment I don't have the API wake up (removed it to isolate the Lin issue), sometimes the microcontroller looks like being stucked into the SCI0 ISR (never returning to the main routine where the Stop mode was called), and some other times it looks like the system indeed returns to the main but do not answer to any Lin command.
I have the following questions related to the matter:
1.- When the system wake up from Stop mode, what is the status of the system ? (Some internal module needs to be re-initialized to work as before the Stop command)?
2.- Is there any special consideration for the LIN interface when the SCIACR1_RXEDGIE is set?
3.- Does the microcontroller needs any special command or is it enough with the toggle of the break in the signal?


Here I let you a snippet of the code:


Lin Init:

LP0CR_LPE = 1; // Enable LIN Phy
LP0CR_LPPUE = 1; // Pull up to strong signal
LP0CR_LPWUE = 1; // Enable Lin-Phy wakeup
LP0SLRM = 0x01;


Low Power routine:

SCI0CR1_WAKE = 1; /* Wake up SCI at an idle condition on the RXD pin */
SCI0SR2_AMAP = 1; /* Make SCIAxxx registers accessible */
SCI0ACR1_RXEDGIE = 1; /* Edge interrupt enabled for wake up */
SCI0ASR1_RXEDGIF = 1; /* Clear flag */
SCI0SR2_AMAP = 0; /* Make SCIAxxx registers inaccessible */
SCI0CR2_RWU = 0x01; /* SCI enters into standby state */

asm (ANDCC #0x7F); /* Enable Stop mode */
__asm (STOP); /* Enter Stop mode */


ISR(VectorNumber_Vsci0, SCI0_INT)
SCI0SR2_AMAP = 1; /* Make SCIAxxx registers accessible */
SCI0ACR1_RXEDGIE = 0x00; /* Edge interrupt disabled for wake up */
SCI0ASR1_RXEDGIF = 0x01; /* Clear flag */
//SCI0SR2_AMAP = 0; /* Make SCIAxxx registers inaccessible */

lin_lld_sci_isr(); /* Lin Driver routine*/


Best regards,