Using the PICO2 with the Arduino Framework on PlatformIO
/The title says it all really. I’m working on my Connected Little Boxes and I really want to run the code on the Raspberry Pi PICO2. Annoyingly, this is not one of those things that “just works”. But it can be done. First you need to make sure that your PlatformIO installation is up to date. Navigate to the PlatformIO tab in the Visual Studio plugins. Then select New Terminal from the options. This will open up a terminal window. Now issue the following commands:
platformio pkg update -g
platformio platform update raspberrypi
platformio run -t clean
Once this has completed we can create a PlatformIO.ini entry for the PICO2 platform:
[platformio]
; uncomment the build that you want to select
;default_envs = rpipico
;default_envs = ESP32_DOIT
;default_envs = d1_mini
default_envs = rpipico2
; other environments go here...
[env:rpipico2]
platform = raspberrypi
board = rpipico2w
framework = arduino
; Use Philhower core (RP2040/RP2350 support)
platform_packages =
framework-arduino-pico @ https://github.com/earlephilhower/arduino-pico.git
board_build.filesystem_size = 0.5m
This fetches the libraries from the Earle Phillhower site and configures the target device. The system will only have a half a megabyte of data storage, you can increase this size if you wish. When you have built the code you can find the firmware.uf2 file in the .pio/build/rpipico2 folder. Turn on your PICO with the BOOTSEL button pressed so that it pops up a storage device and then drag this file onto device.
upload_protocol = cmsis-dap
debug_tool = cmsis-dap
If you have a Raspberry Pi Debug probe you can add the above lines to the file so that the program will be deployed to the probe. If you want to deploy to the PICO2 (not the Wi-Fi version) just change the board to rpipico2