Manfred Meier

S12XDP512 failed entering stop mode

Discussion created by Manfred Meier on Nov 4, 2008
Latest reply on Nov 5, 2008 by Manfred Meier
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){
  TIE_C1I = 0;
  TIE_C0I = 0;
  TFLG1 = 0x03;
  TFLG2 = 0x80;
  CLKSEL_PLLSEL = 0; // switch to OSC
  PLLCTL_PLLON = 0; // disable PLL
  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.