How to unbrick a dead XIAO using a XIAO(DAPLink) and OpenOCD

The bootloader area of a XIAO is not write-protected when it is shipped from Seeed. If this area is overwritten for any reason, a XIAO will lose its COM port, will not respond to “double reset”, and will be bricked. A bricked XIAO can be repaired by re-writing the bootloader.
All I needed was a XIAO uploading “simple_daplink_xiao.uf2”, OpenOCD that comes with Arduino IDE, and some script files that I attached. Connect a bricked XIAO and a DAPLink_XIAO with four wires, and double-click “flash.bat” to re-write the bootloader, I was able to repair a bricked XIAO. After re-write, the bootloader area will be set to protect so that it will not be overwritten at least. If I don’t want to protect the bootloader area, I can use “flash_unprotect.bat”.
I have tried it with 6 XIAOs and have been able to use it without any problems so far. You can use the attached “SAMD21_BootloaderProtectCheck.ino” to see if the bootloader area is protected.

Here are the step-by-step instructions.
XIAO_BootloaderRescueTool_DAPLink.ZIP (49.2 KB)

Modifying the "flash.bat"

  1. Unzip “” to an appropriate location.
  2. Open the “flash.bat” with an editor and modify it to suit your PC.
    This file is written to match the standard Arduino IDE installation location, so you will need to change
    Modify the directory containing “openocd.exe” and “cmsis-dap.cfg” as necessary.
    Modify the “XXXXXXXX” username part.

Installing DAPLink

  1. Connect a XIAO used as DAPLink to your PC and double-reset it.
    An explorer window of Arduino drive will open.
  2. Drop “simple_daplink_xiao.uf2” in this window.
    Now, a XIAO can be used as DAPLink.

Re-write the bootloader

  1. Connect a DAPLink_XIAO and a bricked XIAO with 4 wires.
  2. Connect a DAPLink_XIAO to your PC and double-click “flash.bat”.
  3. A command prompt will open and the bootloader will be written.
    If success, the following will be displayed.

Use expansion board

Checking a repaired XIAO

  1. [IMPORTANT] Connect a repaired XIAO to your PC and double-reset to make your PC recognize a XIAO again.
    An explorer window of Arduino drive will open.
  2. [IMPORTANT] In Arduino IDE, tools–Port menu, mark COM port that says “Seeeduino XIAO”.
  3. Compile and upload your sketch, and make sure a XIAO is working as expected.
    If an error occurs, check Tools–Port menu. It may be unmarked, or the port number may have changed.

I found the following link helpful. Thank you.

  1. “Build a DAPLink Deivce using Seeeduino XIAO”.
    To simplify the work, I have included “simple_daplink_xiao.uf2” as an attach file. Thank you.

  2. “How to use Arduino Boards as DAPLink Device”

  3. “The $5 programmer-debugger”

Wow ! Nice piece of work. Tools to support Xiao are very much needed. Seeeduino owes you a debt. Very much appreciated here.