STM32L072 Standby Mode problems
Hello!
I'm using the DISCO-L072CZ-LRWAN1 board and have some trouble using the low power modes.
It seems whenever i enter the low power mode, it immediately wakes up again, I've tried following a few of the guides and can't see what I'm doing wrong. The board steadily draws 45-55 mA from my power supply, and i would expect it to be a lot lower.
I generated a project for the board from MxCube and using CubeIDE, the project is empty except for the init functions and the code below.
Am i missing something here??
This is my code:
RCC->APB1ENR |= RCC_APB1ENR_PWREN;
// Configure MCU low-power mode for CPU deep sleep mode
PWR->CR |= PWR_CR_CWUF; // Clear wakeup flags
PWR->CR |= PWR_CR_PDDS; // 0 = Stop mode, 1 = Standby mode
PWR->CR |= PWR_CR_ULP; // V_{REFINT} is off in low-power mode
(void)PWR->CR; // Ensure that the previous PWR register operations have been completed
// // Configure CPU core
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; // Enable CPU deep sleep mode
// Enter low-power mode
for (;;) {
__DSB();
__WFI();
}
