-
Notifications
You must be signed in to change notification settings - Fork 444
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
Low Power Modes #345
Comments
In the short term I'm unfortunately occupied with other things, but to access the Basically, you will need to rebuild libpico.a to include the
Restarting the IDE should then give the ability to |
Hello, I tried to run make-libpico.sh with GitBash, but don't work. $ ./make-libpico.sh |
You'll need to clone the git repo, run the get.py script to fetch the toolchain (your 1st missing exe), and also of course have cmake installed(the 2nd one). It uses the pico-sdk build process, so all the pico-sdk prerequisites are needed. For cmake, your distro's package manager should have it ( |
Thx for help! I have cloned the git repo, ran get.py and installed cmake. ./make-libpico.sh: line 12: make: command not found I can't install the apt or yum package manager as I'm currently using only Windows 10. Would it be better to use Linux for this? |
Short answer is, "Yes." Long answer is, "Yeeeeeees." :) WSL will work fine too. Alternatively, you can see how they build the Pico SDK under Windows. There is a readme in their project, but I never looked at it since I didn't have the need. The build prerequisites they need are what the |
Thank you for showing me these possibilities :) I took current measurements on the Pico yesterday. With this I avoid the use of pico_sleep and the known problems like "frozen pico" or "printf () / puts () - not possible" after sleep / dormant. |
@WildkatzGithub how did you succeded in setting the clock to 10 MHz? I tried using platform io, but then it's unusable |
Hello, you can set the clock to 10 MHz with this code in the Arduino IDE: #include "pico/stdlib.h" set_sys_clock_khz(10000, true); // Set System clock to 10000 kHz I've already tried lower clocks, but 10 MHz was the lowest clock speed so far without the Pico getting stuck. By the way, if the clock is currently set to 10 MHz, the Pico can only be programmed using the button at this point. |
@WildkatzGithub thank you so much for your 10 MHz power saving hint. A great idea indeed. In my application I do some outdoor measurement every minute and send it via LoRa. In between I have 59s delay. The pico is driven by 3 rechargeable AA NiMH batteries. After I saw your post I created this function: void power_save(uint16_t psinterval){ Now I am testing it since 3 days and it runs stably. I can already tell that the battery voltage drops much slower that before. I should have measured the power consumption before. I will do that once my test is completed. One could play with the voltages, too. Though, I have not yet an idea how much power saving would benefit from that. Let's see. When checking lower clocks than 10 Mhz did you run more that a delay()? |
Looks like this is closed. Unfortunately the Pico SDK sleep modes are unstable per above, but setting a low system clock seems to help at the cost of peripheral(USB) issues. |
Has anyone managed to get sleep_pico working in the Arduino IDE yet? whenever I try to build libpico.a I get the following errors: |
sorry for reviving an old threat but I am wondering if the Pico/rp2040 would stay in the 10Mhz setting after a power cycling or would it revert to the original set frequency in the sketch settings upon reboot? |
On reboot the rom and app will set the core to 133mhz until your app changes it again. So you could set the frequency in your setup() if desired and only a short period would be at the higher frequency. |
Is this still the case today? Are there any alternatives to using the native Pico SDK sleep functions that you know of? |
Hello guys, sorry for bringing up this issue again. I tried to follow the steps that @earlephilhower provided:
But, unfortunaly I'm getting this error when I try to compile:
Looks like it is importing the library (at least this alone does not result in an error anymore) but it is not importing the functions as it should. Testing the solution proposed from step 3 I can succesfully cmake and make the project but there is anything that I should be doing after that? Replacing a CMakeFile in the library with the generated one perhaps? |
@ninjampa The Adafruit SleepyDog Arduino Library now also supports the RP2040 architecture. You can try it if that's what you're looking for. |
Thank you for the support @Phoenix1747, but the Adafruit SleepyDog Arduino Library currently just perform a sleep_ms, as you can check here. The problem with this solution is that RP2040's sleep_ms executes a NOP in the processor, as you can check in this video, it does not shutdown any peripherals. |
Alright, I see no worries! |
@ninjampa did you find any solution for getting pico-extras sleep.h functionality or similar? |
I have successfully completed all 3 points, but get this error message when compiling.
|
Did you recompile the libpico.a using the |
I ran make-libpico.sh. But what do you mean by building? Should I edit another CMake file? If so, which ones and what do I have to do? As I said, I only did the 3 steps you described. Since it didn't work, I finally ran make-libpico.sh again. |
Hello @metrafonic, Well, there is not a supported way of entering a real (regarding power saving) sleep mode. My application at the time was an embedded battery-solar solution (something around uA), so I had to drop the RP2040 in the design. I just noticed that @Phoenix1747 updated the Adafruit SleepyDog Arduino Library that had a delay function and now has a proper sleep_ms, but I didn't use it, can you test it and put the results in here? If the RP is mandatory in low power mode in your project, I suggest looking for a solution like this one. |
@Dj-EKI, do you have the logs from make-libpico.sh? Back in the day I had the same problem, and the reason was because make-libpico.sh was not compiling as it should. |
@ninjampa Relating to the Adafruit SleepyDog Arduino Library, the lib doesn't actually enable any deep sleep modes as you might have already read here: That's good, but it doesn't actually shut down anything. It's still consuming a whole lot of power (relatively) in this mode. |
@Phoenix1747 Thank you, it was my own comment and I forgot about it. |
Oh yeah, true. Didn't even notice that 😄 |
@ninjampa I don't know where the log files are, but I found them here. http://dj-eki.de/Dateien/CMakeFiles.7z |
I managed to implement pico-extras in arduino.
in target_link_libraries:
There are other commands too. See playground. |
I really want to use the rp2040 low power modes but I don't understand this step. Can someone explain how I can run the make-libpico.sh file on windows? |
Does the Windows install of the Pico SDK still install a full MiinGW? If so, then I think you can just run the bash script there. Make sure you're using a full |
Thanks. I'm familiar with Arduino but I struggle with Raspi/Linux/Python subjects and terminology. I've learned now that sh files are Linux related and also managed to install Git Bash and Python3 and to finally run the make-libpico.sh. But now I've reached the hurdle that already stopped @WildkatzGithub, the error message "./make-libpico.sh: line 12: make: command not found". @Dj-EKI's wording "Run make-libpico.sh. Can also be done with Linux" gave me hope that there was a way in windows but maybe I misunderstood. |
It is not easy to equip Windows with Linux components.
|
You can also use |
Now it works!! The RP2040 is sleeping peacefully. Thanks @earlephilhower & @Dj-EKI ! If someone has the same issues:
(edit your directory and user name) On a side note I'm still not getting near the low sleep power consumption of 180µA promised in the RP2040 datasheet (p. 622). I measured 1.2mA during dormant sleep. It's 20x better then the aktive 23mA consumption before, but why is it still 7x higher than spec? Is this a hardware issue or could I switch off more software-wise? Hardware: I'm using the tiny Waveshare RP2040 Zero. The schematics don't indicate power hungry components, the rt9013-33 linear regulator seems fine. Here's my test code, maybe I'm missing something (a button press wakes the rp2040 up for 1 sec)
|
Is there any way to check weather the "make-libpico.sh" bash ran successfully or not? I followed the instructions (from Dj-EKI ) and the sleep.h is found, but the functions (sleep.c) are not. Im using the Pico setup for Windows (https://github.com/raspberrypi/pico-setup-windows/releases) and executed everything in the "Pico - Developer Command Prompt".
|
Make sure you're running your git copy, not the Boards Manager install. The script assumes you're running from the git version of the core and installs the rebuilt libraries into that path, not the path that the Arduino IDE uses for Boards Manager. I believe CMake will give very clear error messages and the script will abort if there is a compile error. Also, |
Is it planned to implement this to the upstream arduino-pico? If yes, when approximately? |
Is this feature already implemented? if no, when will be available? |
Maybe open a new issue. Don't think we'll get an answer here, since this is closed. |
|
Thank you, didn't see this comment until now. |
Hi,
|
Make sure you've followed the whole set of instructions here: https://github.com/earlephilhower/arduino-pico#installing-via-git You might just need to do a couple |
Been messing with this all day with no success. I keep getting the undefined reference error and cant fix it. I've built it on my linux laptop using the make-libpico.sh script and it ran without error. Moved it back over to my windows desktop and I still have this undefined reference error. |
It took me so many days to get it to compile. Finally worked with Ming64. but I am getting this error now:
exit status 1 Compilation error: exit status 1` Does this mean my build was not successful? |
Hi. Is there anyone who has solved the RP2040 not waking up from dormant mode? I'm trying to get it back on key interrupt, but it doesn't wake up. I have pico-sdk and pico-extras installed, as this thread suggests. I am able to use sleep.h functionality. But the mcu does not want to wake up once it goes to dormant mode. Anyone? please! |
Had the same issue, but it worked with this:
|
Hello, I apologize if this is beating a dead horse however I am unclear about the status of this topic. With the recent RP2350 introduction I'm curious if it still the case that the "standard" board support does not support Deep Sleep? This is such a critical feature for so many low power/battery applications. We're working on several solar powered remote applications, and have had to move to the ESP32 for these. It seems from this thread there is a well known solution to manually add Deep Sleep, but it has not yet been rolled into the "standard" library, and that a custom build must be created? Is that accurate? Will this same manual process work for the new RP2350? What contribution is being looked for to make this already included? Thank you for any insights in advance! |
Especially regarding the RP2350, IIRC there are also additional low-power/sleep modes available now. So that would make that even more interesting! |
I'm happy to entertain PRs here, especially since the RP2350 has much better low power support, but I'm not really able to consistently measure very low sleep mode currents to actually test things. If you have some additions, please do send them in! |
@SIeeepy :
AFAIK, no one has been able to replicate those (claimed) results. And "The Raspberries" provided no code to support this claim. There seems to be some dissonance in the ranks at RPi - esp wrt Pico - & even more esp wrt low-power examples. I've speculated that the RPi "talent pool" may be a bit shallow in Pico - demands of a growing business & all that I'll guess. And since I'm opining I'll add this:
Anyway... I've so far been unable to get any low-power example working on my Pico :( so my hat is off to you! But in closing, I'd like to refer you to this comment by Earle P... in my experience (mostly hardware; software only v. recently) his cmt makes a lot of sense! |
AWESOME :)) Looking forward to trying this!! |
Hello Maxgerhardt |
Do you have any plans on implementing the native low power modes that the RP2040? This would be deeply appreciated.
The text was updated successfully, but these errors were encountered: