How to put spark core to sleep and wakeup on interrupt signal on a pin?

Hi @HardWater,

Enter_STANDBY_Mode() sets some flag in backup register before reseting the system to actually enter PWR_EnterSTANDBYMode() in the bootloader mode. So it enter standby mode before the IWDG(Independent watchdog) is turned on. We have taken this path since IWDG is turned on everytime the system boots into the main firmware and so the reset is required to prevent the IWDG being turned ON.

Also PWR_WakeUpPinCmd() is not currently used in bootloader which enables the wakeup pin usage in standby mode.

I am hopeful to sort out all these issues in the next release of the firmware along the lines of Photon release where the IWDG will be enabled only on user request and thus enabling true low power operations without reseting the system when Spark.sleep is called.

Thanks,
Satish

4 Likes

@satishgn Thanks for all the insight into the code operation. I had taken a look at the bootloader and was not sure exactly what was happening there. I am very interested to work further on this, but currently must focus on the design I have at hand. I ended up going down the path of breaking out of DEEP SLEEP via a external hardware reset.

I am sure in our next rev of our pcb we will probably move over to the photon and or revisit this issue.

@satishgn I'd like to throw my vote in for this as well, would love to use it with the photon! Is there any update on this type of feature being rolled out? Currently, it seems that several use cases are limited due to the way sleep functions reset the system, including:

-Ability to maintain pin states in sleep (i.e. being able to leave a pin as output, HIGH while the photon is sleeping).
-Resuming the program from where it left off.
-Lower power consumption during sleep. While 160μA on the photon certainly isn't high, I would think it could be much lower. Looks like the Core was 3.2 μA.

I love the photon and am really hoping for this kind of functionality! :smile:

1 Like

@satishgn: Great tutorial. Even though I purchased my Cores in January of this year (2015), apparently they did not have the bootloader patch applied. (Ditto for the firmware updates, CC3000 patches, etc.) Applied the patch to my Core…and it is now soundly sleeping. I’m using the latest DEVELOP—you can scratch that off the list of problematic functions!