S12XDP512 failed entering stop mode

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

S12XDP512 failed entering stop mode

1,539 Views
Nj0rd
Contributor I
Hi
I tried to enter stop mode on an S12XDP512. But for unknown reasons the device will not stop.
In my project I use TC0, TC1, SPI, 3xUART, IRQ, 3x External Interrupts and MSCAN1. I check all these peripherals for pending interrupts and no interrupt is pending. Moreover the timer interrupts are disabled, the PLL lock interrupt, xgate, COP and RTI are disabled, too. Form my understanding the while loop of my code should never be reached because restart from stop will take place at the related ISR, in my case the IRQ ISR. Unfortunately the loop is always executed.
if(Stop == true){
  __EI()
  TIE_C1I = 0;
  TIE_C0I = 0;
  TFLG1 = 0x03;
  TFLG2 = 0x80;
  CLKSEL_PSTP = 0;
  CLKSEL_PLLSEL = 0; // switch to OSC
  PLLCTL_PLLON = 0; // disable PLL
  Cpu_SetStopMode();
  while(Stop == true){
  if(PORTK_PK3 == 0){
    PORTK_PK3 = 1;
  } else{
    PORTK_PK3 = 0;
  }
}
Did anyone have a clue? I read AN3289 but it doesn't help. Maybe sometimes reading and understanding are two different things. What I understood is: if you have pending interrupts the device will not stay in stop mode. If you have set PSTP = 1 the device will not really stop. If you don't clear S-bit in CRR stop instruction is treated as 2xNOPs. To wake-up the system I-bit in CCR must be cleared.
Thanks in advance for any feedback.
Nj0rd
 
Labels (1)
0 Kudos
2 Replies

284 Views
kef
Specialist I
Is /XIRQ pin high? No matter is X interrupt enabled or not, /XIRQ pulled low wakes the MCU up.
0 Kudos

284 Views
Nj0rd
Contributor I
grr XIRQ was low. Problem solved.
Thanks kef
0 Kudos