How to use Pico with arduino-cli?

Hi,

I've searched extensively, but I cannot find the detail of how to use arduino-cli with the RPi Pico.

The closest that I've got is here which I presumed means that I should be able to copy

.arduino15/packages/arduino/tools/rp2040tools/1.0.6/rp2040load

to the Pico via the disk interface, then reset it and the /tty device should appear.

It doesn't seem to work though. Is it really necessary to short the pins?

If I'm going at it all wrong, I'd really appreciate a pointer to some relevant documentation.

Thanks!

Hi @bwims

No no, nothing so convoluted as that is needed. You can learn the general principles of using Arduino CLI by reading the documentation here:

https://arduino.github.io/arduino-cli/latest/

I'll provide the specific instructions for using the Pico:

There are two popular Arduino boards platforms that provide support for using the Raspberry Pi Pico with the Arduino framework:

Since the tutorial you referenced is for the first of these, I'll write my instructions for that one. But a similar procedure can be used for the third party platform as well if you want to try that one.

  1. Install Arduino CLI by following these instructions:
    https://arduino.github.io/arduino-cli/latest/installation/
  2. Run the following command to update the package index used by the Arduino Boards Manager:
    arduino-cli core update-index
    
  3. Run the following command to install the arduino:mbed_rp2040 boards platform:
    arduino-cli core install arduino:mbed_rp2040
    
  4. Connect your Pico board to your computer with a USB cable.
  5. Run the following command to show the list of serial ports on your computer:
    arduino-cli board list
    
  6. Note the port shown for your Raspberry Pi Pico board in the command output, if any.
  7. If there was no serial port, put the Pico into "USB Mass Storage Mode" by unplugging the USB cable, then holding the "BOOTSEL" button while plugging the USB cable back in (as described in section 3.2 of the "Getting started with Raspberry Pi Pico" PDF.
  8. Run a command with the following format to compile and upload a sketch to your Pico:
    If there was a serial port:
    arduino-cli compile --upload --verbose --fqbn arduino:mbed_rp2040:pico --port <port name> <path to sketch>
    
    If the board is in "USB Mass Storage Mode", you can omit the --port flag:
    arduino-cli compile --upload --verbose --fqbn arduino:mbed_rp2040:pico <path to sketch>
    
    Replace <port name> in the command with the name of the serial port of your board, as shown by the arduino-cli board list output.
    Replace <path to sketch> with the path to the Arduino sketch you want to compile and upload to the Pico.
1 Like

Hello again,

thanks so much for your reply! I had got as far as (7) but had no serial port. This was actually the point of my question. I thought that the tool rp2040load would fix this problem.

It's good to know how to load programs the other way too, thanks.

B.

You are welcome. Best wishes for success with your Pico.

Regards, Per

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.