Is there a way to prevent the photon to wake up from deep sleep on rising edge of the WKP pin?
I need the following behavior:
1 - deep sleep state for 10 minutes with the WKP pin disable (will wake up after 10 minutes)
2 - wake up and run some code
3 - deep sleep for 30 minutes with the WKP pin enable (will wake up after 0 to 30 minutes)
4 - wake up and run some code
5 - go to step 1
@Alec, actually the WKP pin can be disabled using the low level function PWR_WakeUpPinCmd(DISABLE). However, the firmware HAL enables the WKP pin just before going into standby (deep sleep) mode:
void HAL_Core_Execute_Standby_Mode(void)
{
/* Enable WKUP pin */
PWR_WakeUpPinCmd(ENABLE);
/* Request to enter STANDBY mode */
PWR_EnterSTANDBYMode();
/* Following code will not be reached */
while(1);
}
Unless you modify the firmware, you will not be able to achieve what you want. You could raise an issue or PR on the Particle firmware repo to add the ability to enable or disable the WKP pin prior to deep sleeping.
@Alec, welcome then! Particle, like most open source companies, keep their code on Github. You can find it here. You can create an issue by viewing the existing issues and clicking on the New Issue button. You can describe the issue and add a link to this thread for reference.
@peekay123, i am not sure if disabling the WKP would work in this scenario since the STM32 is in standby and timers are not running to wake up the MCU?
The RTC interrupt for timed wake from deep sleep (and Stop Mode sleep too) is still active tho’
There are no “normal” timers involved in waking the device any case.