Issues exiting Shutdown mode on STM32G0B1CEU using WKUP pin
I am attempting to exist from a Shutdown mode using the WKUP6 pin (PB5) on an STM32G0B1CEU.
This is my shutdown code.
HAL_SuspendTick();
__HAL_RCC_PWR_CLK_ENABLE();
HAL_PWREx_EnableGPIOPullUp(PWR_GPIO_B, PWR_GPIO_BIT_5);
HAL_PWREx_EnablePullUpPullDownConfig(); // sets the APC bit in PWR_CR3
HAL_PWREx_EnablePORMonitorSampling();
HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN6_LOW);
// Do reads of registers to ensure they were written
(void)PWR->CR3;
(void)PWR->CR4;
/* Clear all related wakeup flags*/
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WUF);
HAL_PWREx_EnterSHUTDOWNMode();This seems to do almost exactly what I would expect it to do.
PB5 goes high.
Power consumption drops.
However, it never wakes up. I have a wire connected to PB5, which I am measuring with a scope, and confirm that it is going high. I am them shorting that wire to ground and confirm that it goes low. The system doesn’t wake up.
I know it’s not immediately going back to sleep because right now there is no automated way for it to enter sleep mode, I have to send it a serial command over USB.
I’ve searched the forums, messed around with swapping the polarity of the wakeup and using an external power supply to drive it to 3.3V, and double checked the errata... I can’t get it to wake up from WKUP6. What am I missing?
