Hello everyone,
I would like to have your opinion on issue I have for several weeks. I'm working on a Feather M0 Adalogger based on the SAMD21 and I would like to use the sleep mode in order to save energy (system battery-powered).
I use the ArduinoLowPower library to enter into deep sleep (STANDBY mode described in the datasheet) or the different IDLE modes by configuring the SLEEP register. It's working well, including with interrupt.
My concern comes from the state of the pins during the sleep mode. For my system, I need to always maintain a pin to the HIGH state (but not by a pull-up, I need to change its piloting over the time). I can observe, once in sleep mode the pin state is not maintained after several minutes / hours (not very reproductible).
I would like to know if you already face this behavior and if you have the explanation why it happens?
I precise this issue occurs :
- into deep sleep mode (STANDBY mode in the datasheet) but also in idle mode (idle 0, 1 or 2)
With or without interrupt - With Watchdog enabled / disabled
- With internal voltage regulator in low power mode and also forced into normal mode (SYSCTRL->VREG.bit.RUNSTDBY = 1)
Here is a piece of code I used to test the deep sleep and I measure how evolves the pin status.
#include "Arduino.h"
#include "ArduinoLowPower.h"
// Adafruit board pin mapping
#define PIN_OUT A3
uint32_t sleepTime_ms = 3600000;
void setup() {
pinMode(PIN_OUT, OUTPUT);
digitalWrite(PIN_OUT, HIGH);
// Delay to let time to program the Feather once powered, before sleep
delay(10000);
}
void loop() {
// Deep sleep for one hour
LowPower.sleep(sleepTime_ms);
// After wake-up, wait 1s and go back to sleep
delay(1000);
}
I also made an additional test by adding an external pull-up into this pin, but after some hours the pins goes down to 0V, even this pull-up (so it seems the pins goes down to LOW).
If you have any ideas or experience on it, your comment will be very helpful
I made some research but I do not find a full-documented reply.
I hope this is enough clear, do not hesitate to ask for clarifications if needed.
Thanks again