Re-flash bootloader & firmware to bricked Photon


#1

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:


3 dead photon particles
#2

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


#3

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.

Thanks!


#4

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


#5

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


#6

HI@jtzemp,
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 ?
Thanks!


#7

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?


#8

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.


#9

Are you programming it to the correct address?


#10

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.


#11

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?


#12

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


#13

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)


#14

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).