2025-02-20 01:06 PM - last edited on 2025-02-20 01:13 PM by Peter BENSCH
I cannot get STM32WLE5 (on a RAK3172 module) to exit from stop mode on either RTC timer or rising EXTI pin.
I'm using STM Cube HAL functions and the stm32_lpm_if.c library. I have tried pin PB3 as either EXTI3 or as PWR_WKUP3. If I use EXTI3, I set an interrupt handler. The handler gets called when the pin goes high in normal running, but when in stop2 mode, it does not wake up.
Does anyone have example code using this chip/module to do a wakeup on timer OR external pin?
2025-02-20 02:53 PM - edited 2025-02-20 02:54 PM
> How to enter the Stop 2 mode and wake-up from this mode using an external reset
or RTC wakeup timer.
Edit: I guess this is a different chip? Maybe it will still be useful.
2025-02-21 01:18 AM
Hi,
from the readme of that example :
How to enter the Stop 2 mode and wake-up from this mode using an external reset
or RTC wakeup timer.
EXTI_Line20 is internally connected to the RTC Wakeup event.
I cannot see the assignation of any pin to be the "external reset" - I would have expected some EXTI line to be used. There is no IRQ handler for any EXTI line, not even number 20.
Also, what does "internally connected" mean? I want a real world piece of wire to be a wakeup source.
2025-02-21 07:22 AM
Didn't you say you wanted an RTC timer wakeup?
2025-02-21 09:00 AM
I need both RTC wakeup AND external interrupt wakeup:
I want the device to read a sensor every 10 minutes and send that reading over LoRawan to my server. It is battery powered, so it should go into STOP2 mode to preserve power between readings.
There is also a button on the device. When a user presses it, the device should wake, take an immediate reading of the sensor, and send over LoRa. Then return to STOP2 mode.
2025-02-21 10:22 AM
Looks like this may be a solution in stm32_lpm_if.c:
RCC->CFGR |= RCC_CFGR_STOPWUCK;
void PWR_EnterStopMode(void)
{
/* USER CODE BEGIN EnterStopMode_1 */
/* USER CODE END EnterStopMode_1 */
HAL_SuspendTick();
/* Clear Status Flag before entering STOP/STANDBY Mode */
LL_PWR_ClearFlag_C1STOP_C1STB();
/* USER CODE BEGIN EnterStopMode_2 */
RCC->CFGR |= RCC_CFGR_STOPWUCK; // I think this one did the trick
/* USER CODE END EnterStopMode_2 */
HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);
/* USER CODE BEGIN EnterStopMode_3 */
/* USER CODE END EnterStopMode_3 */
}