-
Notifications
You must be signed in to change notification settings - Fork 27
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
Wake up from power.deep_sleep()
via UART incoming data?
#127
Comments
@JohnVidler does CODAL support waking up from UART activity without losing any data? |
CODAL currently does not wake from UART events, but we should be able to work that in. I'm struggling to imagine a situation where this wouldn't be desirable too, certainly for the USB/UART, and maybe for the edge connector as a toggleable option, so having this be enabled for the USB/UART by default would seem to be the correct course. Comments maybe @finneyj ? |
Aaand now it does support it :) Pending the PR above merging into master. |
I would suggest that the default behaviour for
For consistency I think this is the right approach. But probably use |
While there some debate around what the default behaviour should be, as of the merged PR above, you can now configure this in codal.json via the If set (to 1) USB serial events will wake the board from deep sleep. |
Released a new CODAL tag v0.2.43 which adds this support: https://github.com/lancaster-university/codal-microbit-v2/releases/tag/v0.2.43 |
Yes, sorry, I'm meant to use the existing
Yeah, I think this is a very important point. It's probably not very clear to users why they might need to have to include However, with the latest CODAL tag we could simply set the |
As a side note, with the current 0.2.43 CODAL tag there are no getter/setter for enabling disabling wake up via serial, but the status flag can be modified directly: |
I'll roll a proper set call into the next release, but held off for *43 as we're reworking some of the IO interfaces and it'll all be in with that lot. |
Okay, I think the best thing we can do for the v2.1.0 release is to have the "wake on serial" enabled by default, and if we need to, we can add a way to disable it in future releases. |
Yes I think that's a good idea. With CODAL v0.2.43 now used by MicroPython-on-micro:bit v2, this is now the behaviour. |
Great, we can close this as implemented then, thanks everyone! 🎉 |
The main way for CLI/Desktop tools/editors to interact with MicroPython is via serial REPL. When the board is asleep, it will stop responding to serial, so with a programme like this one, the only option is to reflash the micro:bit with MicroPython, as it won't respond to most tools or desktop editors from serial anymore:
At the time of writing, due to issue #126, the programme above won't go to sleep, but to replicate we can simply add Button A as the only wake up source:
While this could be obvious for a small programme that basically sleeps, the same can be trigger with other "normal" programmes that might go to sleep for any amount of time, like with data logging.
Should the board wake up via serial?
If the answer is "yes", it could be:
power.deep_sleep(serial_wake=True)
wake_on
parameter, i.e.power.deep_sleep(wake_on=(pin1, serial))
power.deep_sleep(wake_on=serial)
?@dpgeorge
The text was updated successfully, but these errors were encountered: