Giter VIP home page Giter VIP logo

Comments (7)

facchinm avatar facchinm commented on June 12, 2024

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.

caiello3 avatar caiello3 commented on June 12, 2024

Great. Thanks for taking a look and confirming. Looking forward to an update.

from arduinolowpower.

facchinm avatar facchinm commented on June 12, 2024

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.

jsiddall avatar jsiddall commented on June 12, 2024

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.

garfieldand avatar garfieldand commented on June 12, 2024

@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.

KravitzLab avatar KravitzLab commented on June 12, 2024

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.
image

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.

KravitzLab avatar KravitzLab commented on June 12, 2024

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?)
image

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.
image

from arduinolowpower.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.