Implement Dormant Mode for RPi Pico with Arduino and Pico-SDK


I’m relatively new to the embedded systems domain and I’m trying to enable low power mode on my RPi Pico. I’ve found resources indicating that this can be achieved using the Pico-SDK (source1, source2). As such, I’ve decided to use this branch which integrates both the Arduino framework and the Pico-SDK. I plan to include the <pico/sleep.h> and <hardware/rosc.h> headers and implement a solution similar to this one: Apologies, as a new user, I’m limited to including only two links in a post.

This is my platformio.ini file:

platform = 
board = pico
framework = arduino

board_build.core = earlephilhower
board_build.mcu = rp2040
board_build.f_cpu = 133000000L
board_microros_distro = humble
board_microros_transport = serial

upload_port = /media/pk/RPI-RP2
monitor_speed = 115200

lib_ldf_mode = chain+
lib_deps =

However, I’m facing a couple of challenges:

  • Is my approach to using the SDK functionalities correct or is there a better alternative that I might have missed?

  • If this is the right approach, I need to add the hardware_rosc and pico_sleep libraries. How can I do this? I understand they are part of pico-extras, but how can I incorporate them into my PlatformIO project?

Any guidance would be greatly appreciated.

Thank you.

If you want to keep using the Arduino framework in general, yes that’s right. The other way to use it by creating a Pico-SDK only project, using e.g. This is however not updated anymore so you’d better use the native Pico-SDK CMake tooling instead.

You should be able to just copy-paste the source code files in the lib folder of the project, that is hardware_rosc as lib/hardware_rosc and pico_sleep to lib/pico_sleep.

FYI, if it was something in the Pico-SDK that you needed but Arduino-Pico didn’t include, the way to go would have been to modify the build files that generate libpico.a. Since this is in Pico-Extras however, this does not apply.

Also notable is that per, there already is an Arduino library for it:

1 Like

Thank you for your prompt and insightful response. I’ve copied pico-extras to the lib directory and am now using these two functions:


This works well and my Pico is now consuming very low power. However, I had to remove this line from pico_sleep.c because the setup_default_uart() function was not declared. This modification has caused my Serial communication to stop working after waking up. I’m still a bit unclear about the roles of Arduino-pico and Pico-SDK :stuck_out_tongue:

After switching to your platform-raspberrypi fork, my arduino::UART disappeared. Without giving it much thought, I decided to use SerialUART. It usually works well, but due to the absence of function I mentioned before, it doesn’t work after waking up.

What is the optimal method to restart SerialUART and any other required components without having to reset the entire microcontroller?

I think that’s a thing only in ArduinoCore-mbed, not Arduino-Pico?

It should have the Arduino-standard Serial.end(); and Serial.begin(); functions, no?

I was wondering if there was a solution to this or further understanding of what to do as I am also facing this same issue. This is the message that shows up in the terminal in VScode.

c:/users/username/.platformio/packages/toolchain-rp2040-earlephilhower/bin/…/lib/gcc/arm-none-eabi/12.3.0/…/…/…/…/arm-none-eabi/bin/ld.exe: C:\Users\username\Documents\Dev\arduino-pico\lib\libpico.a(stdlib.c.obj): in function setup_default_uart': /home/earle/Arduino/hardware/pico/rp2040/pico-sdk/src/rp2_common/pico_stdlib/stdlib.c:110: undefined reference to stdio_uart_init’
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\upt_rp2040\firmware.elf] Error 1