-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
rp2: Can't wake from lightsleep with Pin IRQ #7035
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
well, it looks like the docs is a bit ahead of its time. also there is no wake or priority parameter to .irq()
|
For what I have seen, support does not seems implemented yet for the pico. From my experiments, it seems that in the meantime you could try experimenting with using a function such as
In itself it may not save a lot of energy, but it could serve as a workaround. For my use case, I want to use the deepsleep mode, which does not seems to be supported yet either. So I have started cobbling together a small experimental lib to use while waiting for the feature to be added in micropython. If any tinkerer feels adventurous and want to give it a run and help improving things they are very welcome: https://github.com/tomjorquera/pico-micropython-lowpower-workaround |
I have been looking at this, and have found that the raspberrypi/pic--extras repository has the code to activate dormant mode in the hardware_rosc module. It should be accompanied by a method to check that wake_irqs are set before calling the dormant mode. My cloned repository jf-micropython-pico which also uses jf-pico-sdk repo shows how I implemented and use it. Wake on irq works well using micropython. This is just a proof of concept example. Where this code goes would be up for discusion by more knowledgable persons. I have some code in gpio and some in Pin. The code also needs to be extended to be workable with xosc, and allow transparent use depending on rosc or xosc being used. The repositories may not necessarily be up to date with the originals but still shows that dormant mode can easily be implemented. |
How about a disclaimer machine.Pin rp2 not fully implemented |
Hi @kevindawson is there a new microPython build available for Pico? the old/current one doesn't have .IDLE, .SLEEP, .DEEPSLEEP as I quoted above in this thread |
@cipy |
Ah, this v1.15 is newer than the v1.14 (February) I tested with 🥳
…On Thu 29. Apr 2021 at 14.11 BOWTIE ***@***.***> wrote:
@cipy <https://github.com/cipy>
I was using rp2-pico-20210418-v1.15.uf2
are you saying I should be using
rp2-pico-20210427-unstable-v1.15-14-g65b90cd0f.uf2 (latest)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7035 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIUFEVCAF23CPIX3MM2ME3TLE5GZANCNFSM4ZGERZKA>
.
|
@cipy from: rp2-pico-20210418-v1.15.uf2
is this of any help |
Not much has changed with 1.15 and definitely nothing to do with sleep and wake. Which is why I started looking at what was involved to implement a basic form of wake on pin interrupt. See my discussions previously. |
@jmfloyd Thanks I will go and read |
@tomjorquera many thanks for this: pico-micropython-lowpower-workaround Though the Feather 2040 doesn't always restart when running lowpower_example.py |
Good to know @industrialinternet ! I don't have a feather, so I can't reproduce the issue you describe atm, but I created an an issue on my workaround repo. |
@tomjorquera I've got some TPL5111 Low Power Timers on order I'm new to micropython but have done Squirrel & JavaScript on arm mcu's for IoT proof of concepts. |
I was testing machine.deepsleep on Pico and it does not save any power, same as machine.sleep. However the lowpower.py works great for me. The powerconsumtion goes from 20mA to 1.1mA. Next step is to connect the DS3231 |
Problem with sleep now raised as #8770. |
It's not even implemented in 1.19.1: dir(machine)
|
|
Hey folks, and thank for the mention @kevindawson. Sorry to kind of highjacking the topic, but I happen to be in the process of adding a fix made by another people for an issue reported by some user with the pico not going out of dormant mode. It's currently in the following branch https://github.com/tomjorquera/pico-micropython-lowpower-workaround/tree/clear-clocks I could not reproduce the bug myself, so if some folks want to help test things (and especially this new branch), while waiting for official support... 😉 |
@tomjorquera you are welcome |
…n-main Translations update from Hosted Weblate
Are there any alternatives for nodemcu (esp8266)? The pico workaround does not seem to apply. I wanted to use |
Thanks for these links. In fact, I was trying to have MicroPython on RP0204 waking up from |
This is still not possible right? At least machine.SLEEP does still not exist but the documentation says so :( |
The documentation tells about machine.sleep(): "This function is deprecated, use lightsleep() instead with no arguments." |
I was talking about the Pin IRQ Wake - sorry if that was not clear enough. |
That's right. At RP2 one cannot stop machine.lightsleep() or machine.deepsleep() with a Pin IRQ. |
After some tests it seems that the RP2040 does at least react to IRQs (without setting them up with a wake flag). But somehow the IRQ only fires once in a while. I have sensors which trigger the IRQ and if the RP2 runs normal without sleep, it works as expected. If I set it to lightsleep it only gets like 30% of the interrupts.. which is a bit weird tbh. So the IRQ works with lightsleep but not 100%, anyone else has this experiences? |
Hi All, Thanks an Reg |
I was looking into this just now, as a secondary issue to the regression reported in #16181. I think the current situation for RP2040 is that
I've opened draft PR #16442 to make this more consistent, but there still a couple of things that need resolving before that's ready.
FWIW, I think the only port with an |
On a pin change this code sample toggles the LED but never outputs "got here".
The docs indicate that to fix this, the IRQ should be instantiated with
wake=machine.SLEEP
. Unfortunately this constant does not exist.The text was updated successfully, but these errors were encountered: