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

Hi, Many thanks for the guide. I was unable to get the batch script work with the flash.cfg. flash.bat returned errors suggesting that the device couldn’t be found/wasn’t attached to my st-link v2. At this point I assumed I had destroyed the device but I found the following command line call to openocd that does:

.\openocd -f interface/stlink.cfg -c “transport select swd” -f target/nrf52.cfg -c “init;halt;nrf5 mass_erase;program Seeed_XIAO_nrf52840_bootloader-0.6.2_s140_7.3.0.hex verify reset; exit”

Brief Instructions:

  1. I used a ST-link v2. Connect 3v to the 3v pin on the xiao. Connect GND to a GND pin on the xiao. Connect SWDIO and SWCLK to the solder pads on the back of the device (I melted the GND pad off, but using a GND pin works just fine).
  2. Download and install openocd in a directory on your windows machine. Google will tell you how.
  3. Go to openocd/bin and place the .hex file for the latest bootloader in the same location as the openocd.exe file. I found it in the arudino ide as instructed here but there were several locations ala Google.
  4. Modify the command to reflect the actual name of the bootloader file in the step above.
  5. Open a command prompt. Go to the directory openocd\bin.
  6. Cut and the paste the command line call (modified as required), and hit return.

I don’t know why the flash.cfg didn’t work. I did try to use transport select swd instead of transport select ha_swd and was told that me device (a st-link v2) didn’t support it.