AnsweredAssumed Answered

S12ZVL32 STOP mode accident

Question asked by wu wenbin on Sep 10, 2018
Latest reply on Sep 11, 2018 by wu wenbin

hi,

the MCU work well most of the time but sometimes the amount of current consumed is about 10Ma after receive LIN sleep command (0x3c),it is still in normal mode by monitoring bus output,then if i send LIN sleep command again,MCU will go sleep mode well .


I am using S12ZVL32.
I put the MCU in full stop mode by LIN (0x3c) and wake up by input active interrupt;
I judged the mode by current measurement and bus output(ECLKCTL_NECLK=0).

 

problem 1:__asm(ANDCC #0x7F); __asm(STOP); // Are these two instructions going to make the MCU enter the stop mode without any other prerequisites?

problem 2:I have two guesses, enter stop mode failure or break out of stop mode through the default interrupts of MCU systems which I not configurate in the programm.


Something incomprehensible has happend when I disable the TIMER interrupt before STOP instruction,MCU always work successfully.


//Experiments show that ecu_enter_sleep_mode() will be always executed after receive sleep command LIN(0x3c)
void ecu_enter_sleep_mode(void)
{
      SCI0ASR1_RXEDGIF = 1;
      SCI0ACR1_RXEDGIE = 1;
      //TIM0TIE = 0x00;//timer interrupt is enabled all the time.if i disable the timer interrupt during stop mode,MCU always                                     work well.
       port_set_low_power_mode();
       cpu_set_stop_mode();//#define cpu_set_stop_mode() { __asm(ANDCC #0x7F); __asm(STOP); }
}
void wake_up_ecu(void)
{
         // TIM0TIE = 0x21;//the instruction should be added if disabled before.
         port_init();
}

// Suppose cpu_set_stop_mode() let the MCU go into stop mode.
// Experiments show that When an exception occurs ,the MCU break out of stop mode not through SCI0 interrupt program
// I'm sure that I only use TIMER interrupt and input active interrupt.Could it be the system's default interrupt program?
void sci0_isr_handler(void)
{
      if (SCI0ASR1_RXEDGIF == 1 && SCI0ACR1_RXEDGIE == 1) /* An active edge on the receive input has occurred */
      {
            SCI0ACR1_RXEDGIE = 0;
            SCI0ASR1_RXEDGIF = 1;
      }
}
It is a long time since I am trying to fix this problem and now I have no other ideas to fix it.

Outcomes