press “R” and hold, then press “B”, upload sketch failed times!
Are you not being able to enter the bootloader mode?
I have a similar issue. As instructed from this page:XIAO RP2040 with Arduino - Seeed Wiki
If I power up with the boot button pressed, I get the RPI-RP2 disk window open. If I start the Arduino IDE version 1.8.19 then try to select a serial port, I find that the device is not present. If I plug in the XIAO-RP2040 without pressing the boot button, I can select the serial port but the IDE always fails to load the program. The message I receive is: “An error occurred while uploading the sketch” I have not found a combination that works. The board Manager version is the latest 2.7.2
Thanks for any help.
I purchased 8 of these because I could not get the SAMD XAIO version.
please refer to this wiki
Thanks for the suggestion Jay1206.
Following the instructions provided in the Wiki does not resolve the problem.
The wiki suggests:
“Long press the “B” button
Connect the XIAO to your computer
The computer will appear a disk driver.”(this is awkward english)
I take this to mean, hold the B button while connecting the XIAO to the USB cable.
This does open a disk window but the serial port does not appear.
If I disconnect the XIAO then reconnect, the port appears but I always get an error when I try to upload a sketch.
The RPI-RP2 disk window appears and after a time I get the following message:
“An error occurred while uploading the sketch”
The disk window remains open at this point and the serial port disappears.
I have tried the programming procedure with multiple rp2040 with the same result.
I have the same problem as Craig on 3 different boards. I have tried on 2 different PCs with the exact same results. Let me know if anyone is able to figure this out.
That’s true! I try the board Manager version 1.9.3, the problems disappeared.
Same problem here: Board manager v2.7.2 not working.
I changed to v1.12.0 - and now I can upload code.
2.7.2 has another problem:
~/.arduino15/packages/Seeeduino/hardware/rp2040/2.7.2/variants/ has “Seeed_XIAO_RP2040” but the iDE expects “SEEED_XIAO_RP2040”. I renamed it. That fixes this problem. You guys should not only test on Windows!
I fund a tedious solution to the above problems:
It seems that the downloader is to fast to find the new memory device.
After it fails I can simply copy the the *.uf2 file from the tmp compile directory (in /tmp/arduino…) to the directory of the RPI-RP2/ device. It will disappear shortly after and the program is started.
All in all a half done solution. But in the way it is it fits to the half baked arduino stuff.
We are aware of this issue and have sent feedback to R&D to follow up. We apologise for any inconvenience caused.
In fact, when this issue was first released, we already found that some computers would not be able to upload the program, but we have not been able to find the root cause of the problem to cure it. I will urge R&D to resolve the issue as soon as possible.
Here are some notes about how I got things to work. If any Seeed developers can read this, maybe they can make a fix. It’s really simple once you know what the problem is.
- Use Boards Manager to remove XIAO RP2040 package 2.7.2
- Use Boards Manager to install package 1.12.0
- Use Boards Manager to upgrade the package to 2.7.2
Note that these steps fix the missing tools blunder that my other post refers to, but does not fix the upper-case blunder that Linux users like @rbehm must fix. (Rather than rename the file, I created a symbolic link.)
Footnote: When you are in Boot mode, you can drag and drop a MicroPython or CircuitPython script to the board, but Arduino can not talk to it since there is no serial port.
With the Arduino tools installed as I showed above, you get a serial port to use with Arduino when you do a non-boot reset. After the very first upload from Arduino the serial port number may (or, maybe, not) change to a new value, which you will use for all subsequent Arduino activity.
In the mean time I solved the download problem myself. I prefer to use a decent C/C++ editor (QtCreator). I use arduino-cli from a makefile. In the makefile I convert the *.elf to *.uf2 and copy it to the device.
But your above description does not solve the SPI problem. Even after restoring the changes you describe.
To solve the SPI problem with board package 2.7.2, you have to change some pin assignments in the pins_arduino.h file in the variant directory. This is true for Windows and for Linux.
I’ll repeat myself: With board package 1.12.0, I2C did not work. I made some kludgy changes to pins_arduino.h to make Wire and Wire1 available. The I2C pins shown on the XIAO RP2040 pinout only work with Wire1 for that board package. Some libraries were not set up to let the user have Wire1 as the I2C connections, so this was pretty much unacceptable for general use. As far as I can remember, SPI worked.
Now, forward to board package 2.7.2
Now, I2C works. It was not just a matter of renaming some pins in pins_arduino.h, but the Seeed guys worked behind the scenes to get things going with Wire (so all of the libraries that I needed work also).
The big Oops was that the Seeed guys changed the SPI pin assignments in pins_arduino.h so that now SPI doesn’t work(!!!) Thankfully, I got SPI to work by simply changing a few assignments in pins_arduino.h
Here’s how I got SPI to work with board package 2.7.2
/* * As of August 25, 2022, The Seeed XIAO RP2040 Board package, version 2.7.2, * has incorrect assignments for PIN_SPI_MISO, PIN_SPI_MOSI, and PIN_SPI_SCK, * with the result that SPI functions will not work. * I changed lines 71-75 to make assignments consistent with XIAO RP2040 * pinout diagrams * Here are those lines in the distribution // SPI #define PIN_SPI_MISO (16u) #define PIN_SPI_MOSI (19u) #define PIN_SPI_SCK (18u) #define PIN_SPI_SS (17u) To get SPI to work as expected and as indicated on the XIAO RP2040 pintout diagram, I changed those lines to // SPI #define PIN_SPI_MISO (PIN_D9) // From davekw7x: Was (16u) #define PIN_SPI_MOSI (PIN_D10) // From davekw7x: Was (19u) #define PIN_SPI_SCK (PIN_D8) // From davekw7x: Was (18u) #define PIN_SPI_SS (PIN_D7) // From davekw7x: Was (17u) * */
So far, I have tried to address the original posts in this thread, and with these changes, I could upload and execute programs (including SPI stuff and I2C stuff) from my Windows 10 workstation and from my Raspberry Pi 400.
Now here’s some Linux Stuff:
For another point of reference, I installed Arduino on my recently upgraded Debian 22.04.01 workstation. After following all of the steps I listed above, sure enough, the rp2040tools were in place, but it failed to upload(!) I had to export the binary file and convert to uf2, as you did. I used picotool to load the uf2 to the XIAO RP2040.
So, I feel that your comment about timing in the interaction between the Arduino IDE and the XIAO RP2040 2.7.2 package is probably correct.
Debian workstation CPU is an Intel i7-9 with 8 processors at 2.4 GHz
Rpi400 CPU is an Armv7 with four processors at 128 MHz
Just for kicks, I decided to experiment with Arduino 2.0 (Downloaded and installed Arduino IDE 2.0.0-rc9.4 on my Debian workstation). Followed the same procedure to get board package 2.7.2 installed. Same results (rp2040tools are in place, but fails to upload).
One interesting thing about Arduino 2.0 is that the “Export binary file” stuff also creates a working .uf2 file, so I only needed picotool to actually load the RP2040.
LATE-BREAKING NEWS: THIS JUST IN!
This subject was really bugging me. I struggled with the idea of some timing “issue” that made the upload work for some Linux distributions and not for others. Here’s how I made it work on two different Debian distributions—one with an old slow CPU and the other with a somewhat better one. Both distributions had always failed the Arduino upload.
I found that a shell script named post_install.sh apparently didn’t run properly on these workstations, but the Raspberry Pi 400 worked OK. When I ran it manually it fixed all of my Linux installations.
My Arduino distribution was installed below .arduino15 under my home directory. I navigated to .arduino15/packages/Seeeduino/rp2040/2.7.2 and executed that script as root. Here’s what it looked like on both of the previously non-working boxes:
dave@7010MT:~/.arduino15/packages/Seeeduino/hardware/rp2040/2.7.2$ sudo sh post_install.sh post_install.sh: 12: [: Illegal number: Reload rules... dave@7010MT:~/.arduino15/packages/Seeeduino/hardware/rp2040/2.7.2$
A reminder in case some users didn’t follow my previous steps:
Be sure and check to see that the Seeeduino/tools directory contains a subdirectory named rp2040tools
Bottom line: Taaa-Daaa!
No more “Export binary file” and picotool stuff with my RP2040 board version 2.7.2 package with Arduino 1.8.19—Just click the Upload arrow.
 For Linux users you must fix the Upper Case problem with the variants name.
 For Linux and Windows users: If you want to use SPI, ya still gotta fix the SPI pin definitions in the variant’s pins_arduino.h file
oHHHH, after another a lot of several attemps. It finally work! Really thanks to your help!
By the way, version 2.7.2 seems missing some information which has been shown in the verison 1.12.0 in the tools menu, it might be normal, right?
We have updated the Wiki, please replace the link to the on-board package to use the latest XIAO RP2040 on-board package files.