2025-02-24 06:17 AM
Hi,
I am working on STM32WB55RG MCU and I wanted to enable one pin for Wakeup from Shutdown mode. That works fine.
But, when another EXTI pin is initialized, I am not able to disable it. The MCU wakes up when this pin (connector) state is changed, even while it is disabled using the HAP API.
In the code below, I want to enable wakeup for PIN1, which is a switch. But disable PIN4.
bool LowPower_EnterShutdownMode(void)
{
HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN4);
HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1_LOW);
HAL_PWREx_EnterSHUTDOWNMode();
NVIC_SystemReset();
}
it also does not work when all the rest of the pins are made analog as well.
#define STAT_Pin GPIO_PIN_4
#define STAT_GPIO_Port GPIOE
#define USR_BTN_Pin GPIO_PIN_0
#define USR_BTN_GPIO_Port GPIOA
/*Configure GPIO pin : PtPin */
GPIO_InitStruct.Pin = USR_BTN_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(USR_BTN_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pin : PtPin */
GPIO_InitStruct.Pin = STAT_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(STAT_GPIO_Port, &GPIO_InitStruct);
Am I missing something here?
Best regards,
Navin
2025-02-24 06:51 AM
What is keeping the pin at a known state to prevent noise from triggering it? Has to be a pullup or pulldown somewhere.
> it also does not work when all the rest of the pins are made analog as well.
So when you make other pins analog, pin 1 doesn't cause a wakeup any more? That doesn't quite add up. Sure you're not overwriting the pin 1 configuration somewhere in there?
2025-02-24 08:01 AM
Hello @TDK,
Thank you for the response.
> What is keeping the pin at a known state to prevent noise from triggering it? Has to be a pullup or pulldown somewhere.
For the pin we want the device to wake-up, it is connected to a button.
For, the pin that we do not want to wake up, it is pulled up. This is the pin that needs to be disabled from wake-up. This pin is connected to the charger ACOK (input power detection).
> So when you make other pins analog, pin 1 doesn't cause a wakeup any more? That doesn't quite add up. Sure you're not overwriting the pin 1 configuration somewhere in there?
Sorry, I was not clear. When I made pin 4 analog as well, the MCU was still waking up from sleep.
2025-02-24 11:46 AM
> For the pin we want the device to wake-up, it is connected to a button.
It needs a pullup or pulldown to be at a known state. Just a button won't do. You can use the internal pullup if they can be active in shutdown mode. Not sure if that's possible or not, but the reference manual would let you know.