We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello everyone,
I have a problem with WFI instruction and deep sleep mode.Normally everything work correct, but sometimes processor ignore instruction WFI and continue work.
I use ARM Cortex-M0+ (exactly STM32L051), and below is my sleep procedure:
__ASM volatile ("cpsid i" : : : "memory"); // if WKUP pins are already high, the WUF bit will be set PWR->CSR |= PWR_CSR_EWUP2; PWR->CR |= PWR_CR_CWUF | // clear the WUF flag after 2 clock cycles PWR_CR_CSBF | // clear StandBy flag PWR_CR_ULP; // V_{REFINT} is off in low-power mode PWR->CR |= PWR_CR_LPSDSR | // PWR_CR_PDDS; // Enter Standby mode when the CPU enters deepsleep SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; // low-power mode = stop mode __WFI(); // enter low-power mode while(1) { uprintf("Interrupt loop"); }
I haven't found information on the conditions that must be met before use WFI in deep sleep mode.