Particle debugger to recover electron?

The problem is old but still relevant, so I thought I would write the way I solved the “blue death” on an Electron using “Particle debugger” in Windows10:

  1. Connect the “Particle debugger” to the dead Particle Electron.
    SWDIO (Debugger) → D7 (Electron)
    SWCLK → DG
    GND → GND
    see: setup
  2. Connect the debugger with the USB port.
  3. Connect the Electron with the USB port. The debugger should show a blue LED and so should the Electron do.
  4. Download Particle Workbench. The workbench also downloads OPENOCD (version 0.11 in my case), to communicate with the Electron.
  5. Download bootloader and firmware from here
  6. Open a terminal and go to
C:\Users\<myname>\.particle\toolchains\openocd\0.11.2-adhoc6ea4372.0\bin
  1. unset the “Device security bit and program bootloader”
openocd -f interface/cmsis-dap.cfg -f target/stm32f2x.cfg -c "adapter_khz 1000" -c "transport select swd" -c "init" -c "reset halt" -c "stm32f2x unlock 0" -c "reset halt"  -c "exit"
openocd -f interface/cmsis-dap.cfg -f target/stm32f2x.cfg -c "adapter_khz 1000" -c "transport select swd" -c "init" -c "reset halt"  -c "flash protect 0 0 0 off" -c "program /Users/<myname>/Downloads/electron-bootloader_2.2.0_lto.bin verify 0x08000000" -c "flash protect 0 0 0 on" -c "exit"
  1. program system and user firmware:
openocd -f interface/cmsis-dap.cfg -f target/stm32f2x.cfg -c "adapter_khz 1000" -c "transport select swd" -c "init" -c "reset halt" -c "flash protect 0 5 8 off" -c "program /Users/<myname>/Downloads/electron-system-part1_2.2.0.bin verify 0x08060000" -c "program /Users/<myname>/Downloads/electron-system-part2_2.2.0.bin verify 0x08020000" -c "program /Users/<myname>/Downloads/electron-system-part3_2.2.0.bin verify 0x08040000" -c "flash protect 0 5 8 on" -c "exit"
particle flash --usb firmware.bin
  1. Erase (reset) configuration:
openocd -f interface/cmsis-dap.cfg -f target/stm32f2x.cfg -c "adapter_khz 1000" -c "transport select swd" -c "init" -c "reset halt" -c "flash erase_sector 0 1 2"
  1. Recover keys:
particle keys doctor <device ID>

2 Likes