-
Notifications
You must be signed in to change notification settings - Fork 30
DeepSleepExternalOrTimeWakeup.ino, wakes up immediately without DeepSleep for 10 seconds #118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It could be because the same pin PC0 is used for the Wakeup as well as the Escape Pin for programming. I used a different Wake Pin (PA5 = D10) and it works fine. |
I tried changing the pin, but it just wakes up when I put my finger near the pin. |
I suggest you initialise the pin to either pullup or pulldown. I use PA5 as it can be used to wake from sleep modes using the attachInterrupt function. // Running IRQ Pin
pinMode(WAKE_UP_PIN, INPUT_PULLUP);
attachInterrupt(WAKE_UP_PIN, myWakeup, FALLING);
// Set up the wake-up pin
LowPower.attachInterruptWakeup(WAKE_UP_PIN, nullptr, FALLING); |
This problem does not occur with ExternalWakeup; it occurs when TimedWakeup and ExternalWakeup are used at the same time. |
I'm using the example you mentioned, viz DeepSleepExternalOrTimedWakeup.ino... |
Here is the code being executed and the serial monitor results. BSP2.3.0 stack "None" `#include "ArduinoLowPower.h" #define WAKE_UP_PIN PA5 void setup() // Running IRQ Pin void loop() Serial.printf("Going to deep sleep for 10s at %lu\n", millis()); void myWakeup () { `09:44:17.389 -> Going to deep sleep for 10s at 1014 09:44:17.980 -> Deep sleep with external or timed wakeup 09:44:18.995 -> Going to deep sleep for 10s at 1014 09:44:19.589 -> Deep sleep with external or timed wakeup 09:44:20.604 -> Going to deep sleep for 10s at 1014 09:44:21.197 -> Deep sleep with external or timed wakeup 09:44:22.215 -> Going to deep sleep for 10s at 1014 09:44:22.776 -> Deep sleep with external or timed wakeup 09:44:23.791 -> Going to deep sleep for 10s at 1014 09:44:24.380 -> Deep sleep with external or timed wakeup ` |
I tested your code and it worked fine. At 11:06:54 I triggered a Pin Wake (PA5). 11:06:28.091 [10.657] RX> Deep sleep with external or timed wakeup |
It's strange. My XIAO_MG24 is floating in the air with nothing connected to its pins except it is connected to the PC via USB-C so that it is not affected by its surroundings. I am wondering why LINE130-134 in ArduinoLowPower.cpp has a different command order compared to LINE102-108. If I change the order to be similar to LINE102-108, the problem will not occur. |
OK - I see now. You want to enable Pin Retention on exit from EM4? |
A mechanical switch was assumed for the wake-up signal. |
I am trying “DeepSleepExternalOrTimeWakeup.ino” but it wakes up immediately without DeepSleep for 10 seconds.
I think there is a problem with LINE130 ~ LINE134 in "ArduinoLowPower.cpp".
The text was updated successfully, but these errors were encountered: