XIAO RP2040 Circuitpyton > Arduino programming

Dear Seeed Studio,

I need information (quickly) about XIAO RP2040. Earlier I used it with CircuitPyton. But I’am going to go back Arduino. What do I need to do? I can not upload my arduino Sketch (I got always: An error occurred while uploading the sketch)

Best regards,

Istvan Vamos (Budapest)

Hi, you should press and hold the BOOT buttion and then connect the XIAO RP2040 to the PC.

Then it will pop a disk shown as “RPI-RP2”. You can use it with Arduino after that.
For further information, you can check Seeed Studio XIAO RP2040 with Arduino - Seeed Wiki
Regards
Citric

Dear Citric,
I tried it, but it did not work. Yes, pop up the “RPI-RP2”, but the Arduino IDE does not see the actual port.

After that, I push the Reset button, and pop up the "CIRCUITPY (D:), The Arduino IDE sees the port, but in this case I am in Circuit pyton mode and I can not upload the arduino sketch. What can I do?
Best regards,
Istvan

I had what may have been the same problem. I think that certain things in a Python script in CircuitPython may make the USB port appear busy. Or, sometimes I think people (accidentally or on purpose) fiddle-fart around in the CircuitPython base directory with files named code.py or main.py or main.txt or some such thing, that leaves the port busy.

Anyhow…

My suggestion, based on my experience on Windows 10 and Arduino 1.8.19:

First of all, exit the Mu editor or Thonny, or whatever you have been using for CircuitPython development. Exit the Arduino IDE. Unplug the USB cable to the XIAO RP2040.

Open the Windows Device Manager and note the Ports (COM & LPT) display. (My output is shown on the first attachment, below).

Now plug in the XIAO RP2040 and get it into to Boot mode. My RPI-RP2 shows up as (E:). There is no new COM port in the Device Manager display.

Copy your original CircuitPython .uf2 file to the RPI-RP2 disk.
You can drag-and-drop or use the copy command from a Windows Command window.

When the copy is complete, the XIAO RP2040 will reset, the Windows File Manager now shows CIRCUITPY for the designated disk, and a new USB Serial Device will show up in the Device Manager window. On my system it is COM20. (Second attachment, below.)

Now, open the Arduino IDE with a sketch for your XIAO RP2040. Under Tools->Port menu, select that port.

Just for kicks, open Arduino’s Serial Monitor window. If it says something like “Port is busy” or some such thing, skip down to the “Finally” paragraph below. Then come back here.

If Arduino can open the Serial Monitor for that port, you should be able to upload the sketch.

Now, here’s the thing: After uploading the sketch, the XIAO RP2040 will reset, and a completely different COM port will show up on the Device Manager display. On my system it’s COM58. (Third attachment, below)

If this doesn’t happen, I’m stuck. There may (or, maybe, not) be other things to try, but I can’t help by remote control.

On the other hand, if you did get this far, select the new port in Arduino. Under the Tools->Port menu, it shows up on my system with the helpful designation COM58 (Seeed XIAO RP2040). Now the Serial Monitor will show any Serial output that your sketch commands. This will be the port for all future Arduino uploads and Serial Monitor action.

Finally:
If you don’t have the original CircuitPython .uf2 file or if copying it to the device doesn’t fix things, you can create a completely new file and copy it to the device, so there is no way that remnants of the CircuitPython installation can screw the pooch.

If all of the previous suggestions didn’t help, try copying hidave.uf2 (after unzipping the final attachment below) to the RPI-RP2 disk.
It’s my version of “Hello, World!” that I generated using the Pico SDK when I was getting my feet wet with C/C++ development for RP2040 boards.

Regards,

Dave

noport

com20

com58

hidave.uf2.zip (24.7 KB)

Dear Dave,
Thank you very mutch for your very detailed description.
I will try it!
Istvan

Helo Dave,
I have tried the suggestions, sorry the problem does not solved.
After your hidave.uf2 dragging file, I see on the Serial monitor:

, so something is happened in my RP1_RP2, but dissapeared as a disk.
In this state I tried to upload a “Blink” arduino program, but it is impossible (as earlier),
Again the message is “an error occured while uploading”

(The board is not available on COM15 port).
Are there any other suggestions???
Cheers: Istvan

I’m sorry I couldn’t help. I can only tell you what worked for me.
Windows 10
Arduino 1.8.19

From Boards Manager: Installed “Seeed XIAO RP2040” package version 2.7.2
In Arduino, selected “SEEED XIAO RP2040” from “Arduino Mbed OS RP2040 Boards”

Regards,

Dave

Hello Dave, Thank you for your answer. Temporarily, it would also be nice if I could upload my arduino program like you upload your “Hello Dave” program. How did you make the Hidave.uf2-file?
(I use the same 2.7.2 XIAO RP2040 board version).
Cheers,
Istvan

I created the .uf2 file from a C program using the Raspberry Pi Pico SDK (Software Development Kit) on my Linux system — originally with Debian; lately on a Raspberry Pi 400. The documentation gives a way to install and use the SDK on Windows but I haven’t tried it.

The original project was for a Raspberry Pi Pico, but “it turns out” that the USB serial and built-in LED connections are the same as for the Seeed XIAO RP2040, so this particular .uf2 can be used for either.

The Documents:
Getting started With Raspberry Pi Pico — C/C++

and
Raspberry Pi Pico C/C++ SDK

I attached my SDK project files and the resulting .uf2 file below.

I never used Arduino on my Linux boxes before, but I just now tried and found something verrry interesting:

Arduino version 1.8.19 and 2.0 rc9 work as expected with a couple of boards I just happen to have lying around (Arduino Uno, Nano. ESP32, ESP8266).

However: None of my RP2040 boards (Pico, Pico W, Seeed XIAO RP2040) can be used with Arduino on the Linux systems I tried.

Arduino puts the target in Boot mode and, somehow, copies the compiled .uf2 file to the target, which results in a reset that starts things going. Note that this has nothing to do with whether the target previously ran Circuit Python. It just doesn’t work for me. Period. I’m guessing there is some exotic timing taking place that works for me on Windows 10, but not on the Linux systems I tried.

Anyhow…
It is, undoubtedly, possible to have Arduino export a binary file and use some external program to convert the .bin to a .uf2 so that it can be copied to the target outside of Arduino, but I haven’t tried it and probably won’t.

Regards,

Dave (Pretty much done.)

SDK_hidave.zip (4.1 KB)
hidave.uf2.zip (25.3 KB)

Hi Istvan,

I have exactly the same problem. A soon as I go into boot mode the COM port disappears and the Arduino IDE raises an upload error. If you find out the solution, will you post it here?

Thanks

David Lochlin(Sydney AUS)

Hello David,
Today I found something. Try it: download the lower XIAO RP2040 mother-board manager: 1.12.0 (and not 2.7.2)!

In this case I could upload my arduino sketch.

Cheers:

Istvan

1 Like

Thanks mate, I’ll give it ago.

David

I have listed some things that I hope might clear up a few things here:
XIAO RP2040: Board Package 2.7.2: I2C and SPI can actually work - Products & Technology - Seeed Forum (seeedstudio.com)

Regards,

Dave

Dear Dave,
Thank you very-very much for your message!!!
It is possible to contact with you directly? If yes, drop me a line:
[email protected]
Regards,
Istvan