i'm tryng to wake up MCU STM32L051T6 from stop mode using a GPIO pin. The pin is PB4 on Rising edge.
This is the code:
DBGMCU -> CR |= DBGMCU_CR_DBG_STOP;
RCC -> APB1ENR |= RCC_APB1ENR_PWREN;
RCC -> IOPENR |= RCC_IOPENR_GPIOAEN;
EXTI -> IMR |= EXTI_IMR_IM4;
EXTI -> RTSR |= EXTI_RTSR_TR4;
PWR->CR |= PWR_CR_CWUF; // clear the WUF flag after 2 clock cycles
PWR->CR &= ~( PWR_CR_PDDS ); // Enter stop mode when the CPU enters deepsleep
RCC->CFGR |= RCC_CFGR_STOPWUCK; // HSI16 oscillator is wake-up from stop clock
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; // low-power mode = stop mode
__WFI(); // enter low-power mode
The isr never goes!
Can someboby help me?