Comments (7)
Hi @caiello3 ,
I've been able to reproduce it, thanks. The problem looks related with the serial port status.
In this line we check if we need to deactivate and restore the Serial port, only if it has previously been connected.
The issue seems related with that check, since opening the USB serial port fixes the delay.
I'll investigate the issue a bit more and will let you know!
from arduinolowpower.
Great. Thanks for taking a look and confirming. Looking forward to an update.
from arduinolowpower.
Hi @caiello3 ,
After rechecking all the code I can confirm it's working as expected: the timings are off by 1 second at most, depending on the USB status; this is why the 2 seconds test seems to confirm the issue 🙂 Probably the double period you are noticing is due to a "ping" out of 2 failing for some other reasons.
I'd leave the issue open since the 1 second off is a bit problematic for shorter sleeps and should be solved in the future, but longer sleeps are ok 🙂
from arduinolowpower.
I don't think the serial port status is affecting this. I tried running the sleep function without any of the USB related lines and even with sleep(1), which should be 1 millisecond, I still get a sleep of 1 second or so. It appears that it may just take that long to restart the 48 MHz clock after shutting it down.
from arduinolowpower.
@facchinm, This problem is occurring even when the serial port is not in use at all and never opened. Confirmed with power analyzer. Seen in sleeps of different lengths both under and much over one second.
from arduinolowpower.
Hi! Is there any more information on this? I'm experiencing the same issue with ArduinoLowPower v1.2.2 with an Adafruit Adalogger M0 board. I am using the "TimedWakeup" example in the library, and it always sleeps for ~1s longer than I want. ie: if I modify the sleep call to:
LowPower.sleep(1);
I see this power consumption, showing the processor sleeps for ~934ms, not 1ms.
Is there any more information on why this happens or how to get sub-1s sleep times with this library? In our application we'd like to poll a sensor 5x per second, and sleep between polling. I've also tried detaching USB before sleep but it did not change this behavior. Thanks!
from arduinolowpower.
Just to throw out a bit more information, if I include the line PM->SLEEP.bit.IDLE = 1;
before LowPower.sleep(1)
, the M0 sleeps for ~450ms, so that's an improvement (and maybe a clue to what's going on?)
I also found that LowPower.idle(1)
causes the M0 to enter the idle state for only ~50ms. This is not that useful because idle still burns ~6mA of current, but the timing is much faster.
from arduinolowpower.
Related Issues (20)
- Add RTC time setting and getting functionality
- Absence of README.md file
- Clock disabling code looks wrong HOT 6
- Allow access to RTC HOT 1
- Boards without SERIAL_PORT_USBVIRTUAL HOT 1
- ArduinoLowPower not working (put in Incompatible list) HOT 1
- LowPower.sleep() on Arduino MKR WiFi 1010 HOT 2
- Add GitHub Action based CI
- LowPower.idle() doesn't work as expected, and the argument to LowPower.idle(millis) has absolutely no effect. HOT 5
- ArduinoLowPower and RTCZERO.h HOT 2
- Arduino Nano RP2040 Connect not working with this library
- Add GitHub Actions workflow to synchronise with shared repository labels
- Serial not working after attachAdcInterrupt HOT 1
- Making Low Power great again HOT 1
- Compile problem in Arduino2.0 [nrf_lpcomp_input_t does not name a type] and more HOT 4
- LowPower.detachAdcInterrupt() casues issues with LowPower.attachInterruptWakeup()
- SAMD21 wrong sleep time with Seeedstudio XIAO
- attaching an InterruptWakeup before and after deepSleep breaks RTCZero::getEpoch HOT 2
- detachInterruptWakeup function HOT 1
- Calling LowPower.attachInterruptWakeup with irq_mode CHANGE causes ISR to be fired
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduinolowpower.