Last week, we noted and tried the unofficial Raspberry Pi Pico Arduino Core that works on RP2040 boards, including Raspberry Pi Pico. Everything was super early to set up and the blink sample worked just fine.
But Arduino recently tweeted about the Arduino Core mbed 2.0 release that adds for Raspberry Pi RP2040 boards including Arduino Nano RP2040 Connect and Raspberry Pi Pico boards.
Arduino first used mbed for their Arduino Nano 33 BLE board as they didn’t have an official Arduino core for the Nordic nRF52840 Cortex-M4 microcontroller, and it appears they’ve done the same for Raspberry Pi RP2040 whose mbed implementation itself relies on the C SDK.
Let’s have a try, how hard can it be? We can find the release and changelog on Github with some instructions on the main Github.
First, we can clone the repo in the sketchbook directory (See Arduino IDE’s preferences) which in my case was ~/Arduino:
1 2 3 |
mkdir -p ~/Arduino/hardware/arduino-git cd ~/Arduino/hardware/arduino-git/ git clone https://github.com/arduino/ArduinoCore-mbed mbed |
We’ll also need to clone the ArduinoCore-API:
1 2 |
git clone https://github.com/arduino/ArduinoCore-API ln -s ~/ArduinoCore-API/api mbed/cores/arduino/api |
I could then go to the Boards Manager, look for mbed, and I installed “Arduino Mbed OS RP2040 Boards”
I could then select Raspberry Pi Pico board in the menu, as well as the port to which it is connected: /dev/ttyACM0.
The blink sample could build, but the sample fails to upload to the board.
I tried with two Raspberry Pi Pico boards and both fail the same way, while they worked just fine with the unofficial Arduino Core port. Looking at the kernel log in Ubuntu 20.04 after connecting the board:
1 2 3 4 5 6 7 |
[19281.103834] usb 1-1: new full-speed USB device number 11 using xhci_hcd [19281.279258] usb 1-1: New USB device found, idVendor=2e8a, idProduct=000a, bcdDevice= 1.00 [19281.279263] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [19281.279265] usb 1-1: Product: PicoArduino [19281.279267] usb 1-1: Manufacturer: Raspberry Pi [19281.279269] usb 1-1: SerialNumber: E6605838833D8338 [19281.315348] cdc_acm 1-1:1.0: ttyACM0: USB ACM device |
The ttyACM0 device is properly detected:
1 2 3 4 |
bt -l port | age (sec) | device | driver | description ------+------------+------------+------------------+---------------------- * 0 | 46 | ttyACM0 | cdc_acm | Board CDC |
But attempting to flash the firmware to the board, reboots it in BOOT mode, and the serial port is gone, while the Pico partition (RPI-RP2) is mounted:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
[19354.726744] usb 1-1: USB disconnect, device number 11 [19354.729182] cdc_acm 1-1:1.0: failed to set dtr/rts [19355.005594] usb 1-1: new full-speed USB device number 12 using xhci_hcd [19355.173187] usb 1-1: New USB device found, idVendor=2e8a, idProduct=0003, bcdDevice= 1.00 [19355.173192] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [19355.173196] usb 1-1: Product: RP2 Boot [19355.173199] usb 1-1: Manufacturer: Raspberry Pi [19355.173201] usb 1-1: SerialNumber: E0C912D24340 [19355.175326] usb-storage 1-1:1.0: USB Mass Storage device detected [19355.175506] scsi host2: usb-storage 1-1:1.0 [19356.183622] scsi 2:0:0:0: Direct-Access RPI RP2 1 PQ: 0 ANSI: 2 [19356.184049] sd 2:0:0:0: Attached scsi generic sg2 type 0 [19356.184363] sd 2:0:0:0: [sdc] 262144 512-byte logical blocks: (134 MB/128 MiB) [19356.185221] sd 2:0:0:0: [sdc] Write Protect is off [19356.185223] sd 2:0:0:0: [sdc] Mode Sense: 03 00 00 00 [19356.187259] sd 2:0:0:0: [sdc] No Caching mode page found [19356.187266] sd 2:0:0:0: [sdc] Assuming drive cache: write through [19356.217512] sdc: sdc1 [19356.221243] sd 2:0:0:0: [sdc] Attached SCSI removable disk |
At this point, the Arduino IDE should copy the UF2 file to the partition, but this does not happen. But I found a workaround on Raspberry Pi forum. I located the uf2 file in /tmp/arduino*:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
jaufranc@cnx-laptop-4:/tmp/arduino_build_781291$ ls -l total 5824 -rwxrwxr-x 1 jaufranc jaufranc 89672 Apr 12 16:45 Blink.ino.bin -rwxrwxr-x 1 jaufranc jaufranc 1567000 Apr 12 16:45 Blink.ino.elf -rw-rw-r-- 1 jaufranc jaufranc 179712 Apr 12 16:45 Blink.ino.elf.uf2 -rw-rw-r-- 1 jaufranc jaufranc 252290 Apr 12 16:45 Blink.ino.hex -rw-rw-r-- 1 jaufranc jaufranc 4047278 Apr 12 16:45 Blink.ino.map -rw-r--r-- 1 jaufranc jaufranc 1852 Apr 12 16:45 build.options.json drwxr-xr-x 2 jaufranc jaufranc 4096 Apr 12 16:45 core -rw-r--r-- 1 jaufranc jaufranc 449 Apr 12 16:45 includes.cache drwxr-xr-x 2 jaufranc jaufranc 4096 Apr 12 16:45 libraries drwxr-xr-x 2 jaufranc jaufranc 4096 Apr 12 16:45 preproc drwxr-xr-x 2 jaufranc jaufranc 4096 Apr 12 16:45 sketch |
and copied it to the drive:
1 |
cp Blink.ino.elf.uf2 /media/jaufranc/RPI-RP2/ |
And I got the LED blinking on the board. So that’s a preliminary port, and may explain why Arduino just tweeted about it, rather than write a blog post to announce the release of Arduino Core mbed 2.0 for RP2040 boards.
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress
… you haven’t tried
https://github.com/Wiz-IO/wizio-pico
Why not just use mbed then?, its not that much harder to learn then Arduino.
Arduino has now published a blog post about Arduino Core Mbed 2.0.
https://blog.arduino.cc/2021/04/27/arduino-mbed-core-for-rp2040-boards/