2018-07-09 06:06 AM
I'm having trouble entering stop2 -- instead of going to stop2 my code seems to enter sleep; this is based upon measuring power levels -- I have the RTC fed by an external crystal and a 1 second interval alarm. I can clearly see the transitions from sleep to run and back. I'm just doing the standard thing
MODIFY_REG(PWR->CR1,
PWR_CR1_LPMS, PWR_CR1_LPMS_STOP2); SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk)); __SEV(); __WFE(); __WFE(); CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk));If instead I enter standby, the power levels drop to where I expect them (e.g. < 1uA), so I don't thing this power is leaking outside the stm32. So something is either preventing entry to stop2 or just consuming power internal to the stm32. This board is really simple -- just an adxl362 and a crystal. In a different context (external RTC instead of crystal) I've had no problem entering STOP2. I have read about the PWR_CR1_LPR bit, but I don't think that's the problem. Any thoughts on ways to diagnose this ?
2018-07-11 01:45 PM
Case closed -- do the following before 'going down':
DBGMCU->CR = 0;
Not sure what is setting the flag to keep debug power on (openocd ?), but this was what kept the power on.