Skip to content

Instantly share code, notes, and snippets.

@grahamwhaley
Created March 16, 2022 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grahamwhaley/3ddc31d3456158ed2dfe893ffa0dc560 to your computer and use it in GitHub Desktop.
Save grahamwhaley/3ddc31d3456158ed2dfe893ffa0dc560 to your computer and use it in GitHub Desktop.

Getting your Pi Pico to reflash from Linux Arduino IDE

I picked up some Pi Picos, because well, bang per buck they are looking good - fairly powerful, very cheap.

I'm a Linux user. I tend to do my simpler embedded development under the Arduino IDE. Well, the Pi Picos have Arduino IDE support, so great...

But, life was not quite that simple. I went with the 'official' Pico MBED tool set as found in the IDE installation options. But when I tried to load a sketch, it errored out. The rp2040load command failed.

After much surfing the internet, it was still not clear why. I'd tried all the obvious things - booting with the bootsel button held down etc. I even dropped the blink.uf2 file onto the flash drive and rebooted - well, that worked, but still no luck connecting the IDE...

After more search and head scratching, I saw a suggestion to try running the ro2040load command that failed in the IDE as root on the command line. Using sudo... and, voila, that worked. OK, so now we know it is some some sort of perms issue.

After more head scratching (yes, my user was already in the dialout group, from working with other arduino like boards in the IDE before..., I came across a clue...

Part of the Pico MBED tool install needs to run as root to tweak some perms. But, as we run it automatically from the IDE, that does not happen. Somewhere, apparently, it probably printed in a log somewhere please run as root. Yeah, well, that is not actually that helpful unless it pops up in a big flashing dialog and makes itself obvious....

Well, here is the command that finally made things work better:

.arduino15/packages/arduino/hardware/mbed_rp2040/2.8.0
sudo ./post_install.sh

After that, booting the pico (with the sketch previously loaded from the sudo rp2040load test) allows it to appear as /dev/ttyACM0. The IDE can now download and program the board - hooray.

But, Pi people, if you are reading this, that was way too hard and frustrating. I have a pretty darn good idea what I'm doing here, and it almost defeated me and there the infomation was not obvious from googling. It has to be said, this is the hardest Linux Arduino IDE install of any board I've tried so far. Please see if you can improve it??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment