Re-flash bootloader & firmware to bricked Photon

Hey, Y’all.

I’m sure this is in the source, readmes, community and/or issues on Github somewhere, but it’s all in bits and pieces.

I’ve got a Photon that I bricked doing local dev a while ago. It won’t do factory reset or safe mode. I can’t put it into DFU mode. The RGB led doesn’t light up at all at any stage.

Although I have considered that it’s just a bad LED or something else wrong with the board, due to the circumstances around it’s demise, I’m pretty sure it’s the flash. I was doing a test loop where I would reset it to factory firmware using DFU (and a little bit of st-flash with a programmer shield), run some tests and reset it back to factory firmware. On one of the runs, DFU hung and I ^C'd the terminal. After that, it wouldn’t do anything anymore. I’m assuming that the firmware got corrupted and won’t boot – even in the bootloader.

This Photon probably only went through the loop < 20 times, so I’d be surprised if it was flash wear.

At any rate, I’d like to try to rehabilitate this little Photon and be able to use it as well as learn something new about hardware. (Also document it for posterity here in the community).

I’ve got the (monolithic) factory firmware, as well as an unlocker.bin firmware to unlock the bootloader. I’ve got a new Programmer Shield (and openocd installed), an old Programmer Shield with an ST-Link programmer (and a Mac – although I could install Windows on a Bootcamp partition if necessary).

What I’m lacking is a thorough enough understanding of the behavior of a bricked STM32 chip and the programmer(s) to unlock the flash memory and write new firmware w/o having the ability to put our friend into DFU mode.

Anyone out there wanna take a stab?

Thanks!! :smile:

Not sure about Mac but windows has. Stm32 utility that allows you to unlock the flash blocks

Thanks for your reply, @kennethlimcp!

So, I’ll work on installing Windows in Bootcamp, so I can dual boot, but in the mean time do you, or anyone else have some tips/instructions on which address(es) to unlock and/or how to go about it properly? I’ll try to find, install and play around with the Stm32 utility on Winders and see what I can discover, but if there is/are some good instructions/readmes out there that anyone knows about, I’d love to hear about them.


What i did is to unlock all the addresses and wipe the STM32 chip, reprogram as though it came out of the factory.

Ok, cool! I’ll try the nuclear option. :smile: :bomb:

I make a big mistake .I erased the STM32 through the stm32 utility with a ST-Link. Then I program the locker-firmware.bin to it ,but no response, Now PHOTON is a brick.How can I restore it ?

If you have an stlinkv2, we will be able to give instructions on how to restore the bootloader and system firmware

Are you able to place the device in DFU mode?

I can program the bootloader bin file into STM32 .But I can’t place the photon in DFU mode . When I connect it to PC over USB ,there is no response.

Are you programming it to the correct address?

HI @kennethlimcp ,I have resolved the problem with the spark team’s help.They send me a firmware file callded “combined-0.4.4-photon.bin”,then I program it to the device. It works now. Thank you for your help.


Could you possible share the combined file? After flashing my compiled bootloader I get nothing, not even DFU, does the system have to be flashed for DFU to be operational?

If you frazzled the bootloader you might need a JTAG programmer.
Or this “experimental” setup :wink:

1 Like

Hey Scruff,

Indeed! I’ve already got one hooked up, I’m currently using OpenOCD’s ‘flash write_image’

This actually worked! She’s flashing yellow agian! Woo!

flash write_image erase unlock /home/ddaly/Apps/firmware/build/target/bootloader/platform-6-lto/bootloader.bin 0x08000000 bin
auto erase enabled
auto unlock enabled
target state: halted
target halted due to breakpoint, current mode: Thread
xPSR: 0x61000000 pc: 0x20000042 msp: 0xfffffffc
wrote 16384 bytes from file /home/ddaly/Apps/firmware/build/target/bootloader/platform-6-lto/bootloader.bin in 1.092221s (14.649 KiB/s)


Many thanks ScruffR for the m-mcgowan suggestion. It brought one of my photons back from the dead in 3 minutes! (after I spent long hours with the Particle Workbench).


I have a bricked Photon. On power on, the D7 lights dimly, pushing buttons does nothing. I have installed openocd on my Mac and tried to flash the boot loader using the instructions here:

I have the bricked Photon hooked up with the Particle Debugger and jumpers from D7 to SWDIO, D6 to SWCLK, GND to GND, and VDD to Vin. The Photon powers up (the D7 LED lights).

The commands I use:

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/djohnson/Downloads/1.5.2/photon/release/photon-bootloader@1.5.2+lto.bin
verify 0x08000000”
-c “flash protect 0 0 0 on”
-c “exit”

The response I get:

Open On-Chip Debugger 0.10.0

Licensed under GNU GPL v2

For bug reports, read

Info : auto-selecting first available session transport “swd”. To override use 'transport select '.

adapter speed: 1000 kHz

adapter_nsrst_delay: 100

none separate

cortex_m reset_config sysresetreq

adapter speed: 1000 kHz

Warn : Transport “swd” was already selected


Info : CMSIS-DAP: SWD Supported

Info : CMSIS-DAP: Interface Initialised (SWD)

Info : CMSIS-DAP: FW Version = 1.10

Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1

Info : CMSIS-DAP: Interface ready

Info : clock speed 1000 kHz

Info : SWD DPIDR 0x2ba01477

Info : stm32f2x.cpu: hardware has 6 breakpoints, 4 watchpoints

target halted due to debug-request, current mode: Thread

xPSR: 0x01000000 pc: 0x08003768 msp: 0x20020000

Info : device id = 0x20036411

Info : flash size = 1024kbytes

cleared protection for sectors 0 through 0 on flash bank 0

target halted due to debug-request, current mode: Thread

xPSR: 0x01000000 pc: 0x08003768 msp: 0x20020000

** Programming Started **

auto erase enabled

Warn : no flash bank found for address 0

wrote 0 bytes from file /Users/djohnson/Downloads/1.5.2/photon/release/photon-bootloader@1.5.2+lto.bin in 0.000152s (0.000 KiB/s)

** Programming Finished **

invalid command name “verify”

The main error seems to be ‘Warn : no flash bank found for address 0’.

Suggestions would be very welcome.

– Doug