I have a Xiao SAMD21 that has been in DFU mode (acting like a USB storage device) ever since I hit the cancel button in Arduino IDE 2.0 during a firmware upload.
How can I put some usable firmware on it, and get it out of DFU mode, so that the Arduino software can upload to it again?
Right now the uploads fail because the IDE can’t contact the Xiao over the serial port, which I assume is because the Xiao is in DFU mode.
So, It happens… it’s kinda a Kink in the samd21 Hitting Cancel during upload in Arduino IDE 2.x, it often leaves the Xiao SAMD21 in perpetual bootloader/DFU mode.
In this mode:
It appears as a USB storage device (like Arduino or PORTALBOOT)
It does not enumerate as a COM port
Uploads fail from the Arduino IDE
This is normal behavior for SAMD21 chips — but you need to nudge it back into a healthy state. You have a few options here.
You don’t say what else you have tried , so I’ll list it all and you can confirm.
OPTION 1: Double-Tap Reset Button
If the board has a reset button: (some have only a pin)
Double-tap it quickly (within 500ms).
The board should reappear as a bootloader port (PORTALBOOT, or a COM port if the bootloader is healthy).
Try re-uploading the sketch via Arduino IDE.
If the double-tap doesn’t work, the bootloader may be corrupted.
OPTION 2: Burn Bootloader (recommended in this case)
Since it’s stuck in DFU mode, burning the bootloader is the correct fix.
You’ll need:
Required:
A working USB-to-Serial adapter, or a debugger (like a J-Link or Atmel ICE)
Or another Arduino used as an SWD programmer (harder setup)
The Adafruit SAMD21 UF2 bootloader or Seeed’s Xiao bootloader
bossac tool (if doing it CLI)
Optional: Arduino IDE > Tools > Burn Bootloader if supported
I got it working again by installing the CircuitPython UF2, and then the Arduino IDE could connect to it again over the serial port (on a different port, which took a minute to realize).
But, for future reference, how does one getting a Xiao SAMD21 sketch in UF2 form? I tried compiling with the Arduino IDE 2.0, and the older 1.8 version, but either way I only got .bin and .elf binaries.
I found elf2uf2 utility for the RP2040, but it failed with “ERROR: Memory segment 00000000->0000fb04 is outside of valid address range for device.”
I assume that the Arduino IDEs are creating UF2 files as part of the upload process, but I have no idea where they are saving them. Not in the sketch folder, and not in the appdata\local\arduino folder, and I don’t know where else to look.
So GREAT! you got it back , Yes often with DFU it will change com ports, but for UF2 it’s a utility, You use the “export compiled binary” first on the Sketch menu in the IDE. This will create a Build folder in your sketch folder, in there will be the goods you need to run the util on and out comes a UF2 all nicey, Nice…
I have a thread on here for DRAG & DROP testing… look at that it covers the tools also. Once you learn this method it’s great for production bins or quick program changes without pushing any button
Please Do us a Solid and mark it as the solution so others can find it fast.
I’m using these for when button pushing is the only tech available.:cros