Hi, I’m working on a solar powered project that monitors an I2C magnetometer and publishes events to the cloud when its heading changes.
I’ve got the WiFi on/off side of things working satisfactorily, but I’m finding that even with WiFi turned off the core still draws about 40mA. This is a lot given that my solar cell can only deliver ~50mA in full sunlight. Ideally I would like to keep average current draw down to a few mA so that it will still function on cloudy days and build up enough charge to connect the WiFi every now and then.
I could sample the magnetometer every second and put the core into a deep sleep between samples, but I am concerned about boot-up time and also that I will also have to use non-volatile storage for local variables since these get forgotten in deep sleep.
Is there another way to sleep the core without losing all the local variables? I believe the STM32 has low power “sleep” and “stop” modes that stop the system clock but keep the SRAM register contents. The “standby” mode is a little over the top for my needs. Is there any way we can access this functionality in our applications yet?