How to wake up STM32G070 on EXTI from stop1 mode?
I set up EXTI so I get interupt on the correct pin GPIO B.6. But I cannot get it to wake up from stop1 mode. I call WFI and RTC wakes upp the processor regularly but EXTI will not.
Reading the reference manuel it says any interupt should wake the processor from stop1 mode.
In datasheet wakeup pins are mentioned, but I do not find how they are linked to GPIO.
I am not sure of GPIO clock B shall be enabled or not. Can it be disabled and still wakeup on EXTI? I tried both enable and disable but still the processor did not wakeup.
Here is the relevant code, have I missed setting up something? Maybe wakeup pins are needed but I am not sure how to set them.
void SetupEXTI()
{
GPIO_InitTypeDef GPIO_InitStructure;
__HAL_RCC_GPIOB_CLK_ENABLE();
GPIO_InitStructure.Mode = GPIO_MODE_IT_RISING;
GPIO_InitStructure.Pull = GPIO_NOPULL;
GPIO_InitStructure.Pin = GPIO_PIN_6;
HAL_GPIO_Init(GPIOB, &GPIO_InitStructure);
/* Enable and set line 4_15 Interrupt to the lowest priority */
HAL_NVIC_SetPriority(EXTI4_15_IRQn, 2, 0);
HAL_NVIC_EnableIRQ(EXTI4_15_IRQn);
}
void EXTI4_15_IRQHandler(void)
{
printf("EXTI!!\n\r");
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_6);
}
/* Set STO1 0 mode when CPU enters deepsleep */
LL_PWR_SetPowerMode(LL_PWR_MODE_STOP1);
/* Set SLEEPDEEP bit of Cortex System Control Register */
LL_LPM_EnableDeepSleep();
/* Request Wait For Interrupt */
__WFI();
