pyb.stop() / machine.lightsleep() time to wake up
Posted: Tue Jul 02, 2019 2:14 pm
One fantastic feature of Pyboard D is a very short time to wake up from lightsleep, which has very low current (170 uA) while retaining the RAM state.
I've measured 344-404 us using the software :
With output (last field is in microseconds) : (2019, 6, 30, 7, 17, 23, 30, 30) (2019, 6, 30, 7, 17, 23, 30, 1434)
Without 'pyb.stop()' (as comment) : (2019, 6, 30, 7, 17, 23, 30, 30) (2019, 6, 30, 7, 17, 23, 30, 91)
So the time to 'pyb.stop()' wake up is about (1404-1000-61=344) us.
Alternatively, using 'machine.lightsleep()', gives almost the same result :
With output : (2019, 6, 30, 7, 17, 23, 30, 30) (2019, 6, 30, 7, 17, 23, 30, 1434)
Without 'machine.lightsleep(1)' (as comment) : (2019, 6, 30, 7, 17, 23, 30, 30) (2019, 6, 30, 7, 17, 23, 30, 30)
So the time to 'machine.lightsleep()'' wake up, discarding the 1 ms pause, is about (1404-1000=404) us.
A better measurement would be made using an oscilloscope measuring the timings and current (voltage on a shunt resistor).
I've measured 344-404 us using the software :
Code: Select all
from pyb import RTC
rtc = RTC()
rtc.datetime((2019, 6, 30, 7, 17, 23, 30, 0))
t1 = rtc.datetime()
rtc.wakeup(1)
pyb.stop()
t2 = rtc.datetime()
print(t1, t2)
Without 'pyb.stop()' (as comment) : (2019, 6, 30, 7, 17, 23, 30, 30) (2019, 6, 30, 7, 17, 23, 30, 91)
So the time to 'pyb.stop()' wake up is about (1404-1000-61=344) us.
Alternatively, using 'machine.lightsleep()', gives almost the same result :
Code: Select all
from pyb import RTC
rtc = RTC()
rtc.datetime((2019, 6, 30, 7, 17, 23, 30, 0))
t1 = rtc.datetime()
machine.lightsleep(1)
t2 = rtc.datetime()
print(t1, t2)
Without 'machine.lightsleep(1)' (as comment) : (2019, 6, 30, 7, 17, 23, 30, 30) (2019, 6, 30, 7, 17, 23, 30, 30)
So the time to 'machine.lightsleep()'' wake up, discarding the 1 ms pause, is about (1404-1000=404) us.
A better measurement would be made using an oscilloscope measuring the timings and current (voltage on a shunt resistor).