S12XDP512 failed entering stop mode

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

S12XDP512 failed entering stop mode

2,031 次查看
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
 
标签 (1)
0 项奖励
回复
2 回复数

776 次查看
kef
Specialist I
Is /XIRQ pin high? No matter is X interrupt enabled or not, /XIRQ pulled low wakes the MCU up.
0 项奖励
回复

776 次查看
Nj0rd
Contributor I
grr XIRQ was low. Problem solved.
Thanks kef
0 项奖励
回复