AnsweredAssumed Answered

STM32w108 Sleep Modes

Question asked by baldwin.jake.001 on Jan 15, 2014
Latest reply on Jan 15, 2014 by baldwin.jake.001
I can't for the life of me figure out how to get the STM32w108 the wake up with the sleep timer. I basically want to wake up every 15ms and run my main loop. My initialization routine is very short. Here it is:

   SLPTMR->CMPAL = 15  //write to the lower register must be first
   SLPTMR->CMPAH = 0x00000000;  //high register must be second; just 0s

   SLPTMR->IER |= (1 << 1);   //enable interrupt on register A compare


   NVIC->ISER[0] |= (1 << 4);  //need to unmask the interrupt at the ARM core level in the NVIC


   PWR->WAKECR1 |= ((1 << 4) | (1 << 3) | (1 << 2) | (1 << 1)); //sets the appropriate wake up sources including on a compare A

   SCB->SCR |= (1 << 2);   //enable deep sleep


   SLPTMR->CR |= (1 << 11);   //enable sleep mode timer; everything must be configured before enabling sleep mode timer
   asm("nop"); //needed delay
   asm("nop");
   asm("nop");
   asm("nop");


I go to sleep and I'm only able to wake up with a serial interrupt. The timer doesn't wake me up. Any ideas?

Thanks

Outcomes