Uploading to Pi Pico (MBED 2040)

From my Linux 18.04 I want to program a Raspberry Pi Pico using the Arduino IDE. I have selected the board type “Raspberry Pi Pico” and compiled a blink sketch. However it will not load and I get the message:

rp2040load 1.0.1 - compiled with go1.15.8
…An error occurred while uploading the sketch

This happens on two Pico boards. I have done the whole “hold button down while powering on” thing and my file manager can see into the device and the INFO_UF2.TXT file is there. Also if I manually transfer the compiled Blink.ino.elf.uf2 file the Pico will drop straight into the blink program.

Any clues as to what is going wrong in my case would be welcome.

I order to gather more information that might help us to troubleshoot your problem, I’m going to ask you to post the full output from the upload when in verbose mode.

Please do this:

  1. (In the Arduino IDE) File > Preferences
  2. Uncheck the checkbox next to “Show verbose output during: compilation”
  3. Check the checkbox next to “Show verbose output during: upload”.
  4. Click the “OK” button.
  5. Attempt an upload, as you did before.
  6. After the upload fails, you’ll see a button on the right side of the orange bar “Copy error messages” (or the icon that looks like two pieces of paper at the top right corner of the black console window in the Arduino Web Editor). Click that button.
  7. In a forum reply here, click on the reply field.
  8. Click the </> button on the forum toolbar. This will add the forum’s ``` code tags markup to your reply.
  9. Press “Ctrl + V”. This will paste the upload output between the code tags.
  10. Move the cursor outside of the code tags before you add any additional text to your reply.
Arduino: 1.8.13 (Linux), Board: "Raspberry Pi Pico"

Sketch uses 80072 bytes (0%) of program storage space. Maximum is 16777216 bytes.
Global variables use 52920 bytes (19%) of dynamic memory, leaving 217416 bytes for local variables. Maximum is 270336 bytes.
/home/trevor/.arduino15/packages/arduino/tools/rp2040tools/1.0.2/rp2040load -v -D /tmp/arduino_build_476149/Blink.ino.elf 
rp2040load 1.0.1 - compiled with go1.15.8
.....................An error occurred while uploading the sketch



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I also tried to use MBED 2040, it doesn’t work. I used this guy’s instead GitHub - earlephilhower/arduino-pico: Raspberry Pi Pico Arduino core, for all RP2040 boards

killzone thanks. My aim was to skip the earlephilhower version, however it looks like the best option right now.

Someone asked him recently to add attachInterrupt on github and he responded quite fast. which reminds me I need to ask him for attachInterruptParam. So far I had 0 problems with his implementation, looks like he knows what he is doing.

Had similar problem - also using Linux OS 18.04.

I managed to resolve by first “holding BOOTSEL button down while powering on” and then uploading Arduino blink program using the Arduino IDE. This seemed to “clear up the blockage?”. Then I was able to upload my own sketch as per normal.

Now if that still does not resolve then maybe my other hack had unblocked things first, where I went to the Raspberry Pi website and downloaded their pico helloworld.elm file and dropped that into the pico folder. Then returned to Arduino IDE to flash Blink then my own application etc.

gerrikoio, thank you for your response. The actions in your first paragraph look to be exactly what I am trying to achieve and so I cannot see how simply repeating them is going to help. Perhaps I do not understand what you are suggesting.

In your second paragraph you describe a helloworld.elm file. I am not familiar with this format and cannot find it on the RPi website. It would be helpful if you could give a full location reference.

Oops wrote in haste, my mistake… It is hello_world.uf2

Sorry about that. Can be found on this webpage

https://www.raspberrypi.org/documentation/rp2040/getting-started/#getting-started-with-c

For the record - downloading Helloworld.uf2 from the Foundation site does not fix the problem. However once Helloworld is running I can open the Arduino serial monitor and see the programmed message coming in - meaning I guess that the usb link into the IDE is up and running.

Hence it looks like I am switching to the earlephilhower version.

Here the opposite: this Arduino lib works, the Philhouer one does nothing (because he include a Python 3 runtime that was compiled for OSX 10.15, where the IDE runs on 10.11 and up).
I got the same error as the TS first, but it turned out the USB cable was not in the back of my Mac. Stupid RPI-foundation: they forgot a POWER LED!

Can someone explain why the Blink code is SO MASSIVE? On the ATTiny it is just 700 bytes with 9 bytes of RAM.

Just to complete. I loaded the earlephilhower version and it works straight out, at least as far as blink is concerned, so I can now get on with what I really wanted to do.

For binkjs my advice for a small blink program would be to write assembler for the attiny - compact and satisfying :grinning:

It includes the mBed RTOS code, and all of the library functions that THAT uses. That includes malloc(), printf(), filesystem stuff, and USB drivers so that at least the rp2040 can respond to reset requests. (and THAT includes some of the normal floating point libraries, because not all of the rp2040s out there have double precision float code in ROM.) And the “normal” floating point code for CM0 sucks.)
And THAT’S built on top of the rp2040 SDK, which isn’t tiny either.

At some point, when you have 2MByte of code space and 264KByte of RAM, you are supposed to stop caring that your “small” programs are not so small anymore. It’s somewhat assumed that “large” programs will be using those features anyway, so having them “always present” is not a problem.
In theory, program size is quantized into two sizes: “fits” and “doesn’t fit.”
(But yeah, having “blink” be ~90k is a bit mind-boggling.)

1 Like

Isn’t the nRF line using MBED as well? Some figures of Blink:
Nano 33 BLE Sense: 86576 bytes (Arduino)
Sandeep compiled MBED capable boards:
micro:bit V1: 1388 bytes
micro:bit V2: 1832 bytes
Nordic nRF52 Development Kit: 2208 bytes.
Or is Sandeep delivering way tighter code?
As for the RTOS, can it be left out? It’s also the reason I don’t like the ESP32 with 3 minutes compile time.
For us in the classroom it is not only “will it fit” but more “will it compile fast”. In 50 minutes kids can hardly try any code when compilation is baking this RTOS bloat every upload. Microbit v2 has code uploaded in 5 seconds, the Pi Pico in 40 seconds, the ESP32 in 180 seconds. That gives us an easy choice. micro:bit v2 is probably the best modern “Arduino” right now. Lots of stuff built in (battery connector, sensors, display, mic, buttons, radio/BLE), as fast as a Pico and crazy fast with compilation.

Yep. I don’t know much about either mBed or the nRF chips.
I assume that mBed “helps a lot” when it comes to running an IoT stack, and since the Arduino RP2040 product is going to have wireless, that is the application and build environment that they’re aiming for.

Never heard of it. I assume that neither mBed or wireless support is present in those small images. Adafruit images are intermediate in size (~40k for blink.) I don’t know what they’re doing, either.

On the bright side, the Arduino Pico build appears to use a pre-built mbed library, so it doesn’t incur the build overhead of the ESP packages. And it successfully caches the core, so builds after the first one are much quicker (which I’ve heard doesn’t quite happen for some ESP builds.)

Of course it’s possible to not use mBed (the earlephilhower version doesn’t use it.) But I doubt that it will be possible with the official Arduino board definitions…

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