Un-bricking Photon

Hello! It looks like I bricked my Photon after using the Programmer Shield. I compiled my own firmware using develop branch, then flashed to the device with DFU. It worked, but then I tried to flash the device with a cloud compiled binary, and then the device would not respond anymore. Launching GDB was showing that it is stuck in SIGTRAP with unresolved symbol. I tried to recompile the bootloader and flash it, it looks like it worked (see below), but the device is still not responding. Only D7 is partially lit. What would be the next step to recover the device?

Thanks!

$ cd bootloader/
$ make PLATFORM=photon all program-openocd
[...]
Flashing ../build/target/bootloader/platform-6-lto/bootloader.bin using openocd to address 0x8000000
/home/francis/gitsrc/openocd-0.9.0//src/openocd -f /home/francis/gitsrc/openocd-0.9.0//tcl/interface/ftdi/particle-ftdi.cfg -f /home/francis/gitsrc/openocd-0.9.0//tcl/target/stm32f2x.cfg  -c "init; reset halt" -c "flash protect 0 0 11 off" -c "program ../build/target/bootloader/platform-6-lto/bootloader.bin 0x8000000 reset exit"
Open On-Chip Debugger 0.9.0 (2016-08-07-21:38)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
jtag_ntrst_delay: 100
none separate
cortex_m reset_config sysresetreq
Info : clock speed 1000 kHz
Info : JTAG tap: stm32f2x.cpu tap/device found: 0x4ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x4)
Info : JTAG tap: stm32f2x.bs tap/device found: 0x06411041 (mfg: 0x020, part: 0x6411, ver: 0x0)
Info : stm32f2x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : JTAG tap: stm32f2x.cpu tap/device found: 0x4ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x4)
Info : JTAG tap: stm32f2x.bs tap/device found: 0x06411041 (mfg: 0x020, part: 0x6411, ver: 0x0)
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x08002f1c msp: 0x20020000
Info : device id = 0x20036411
Info : flash size = 1024kbytes
cleared protection for sectors 0 through 11 on flash bank 0
Info : JTAG tap: stm32f2x.cpu tap/device found: 0x4ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x4)
Info : JTAG tap: stm32f2x.bs tap/device found: 0x06411041 (mfg: 0x020, part: 0x6411, ver: 0x0)
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x08002f1c msp: 0x20020000
** Programming Started **
auto erase enabled
wrote 16384 bytes from file ../build/target/bootloader/platform-6-lto/bootloader.bin in 0.729396s (21.936 KiB/s)
** Programming Finished **
** Resetting Target **
Info : JTAG tap: stm32f2x.cpu tap/device found: 0x4ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x4)
Info : JTAG tap: stm32f2x.bs tap/device found: 0x06411041 (mfg: 0x020, part: 0x6411, ver: 0x0)
shutdown command invoked

BTW, I had to adjust the path to openocd:

[francis@T440 bootloader]$ git diff
diff --git a/build/module.mk b/build/module.mk
index 3babfef..7c5e7da 100644
--- a/build/module.mk
+++ b/build/module.mk
@@ -71,7 +71,7 @@ ifneq ("$(OPENOCD_HOME)","")
 
 program-openocd: $(TARGET_BASE).bin
        @echo Flashing $< using openocd to address $(PLATFORM_DFU)
-       $(OPENOCD_HOME)/openocd -f $(OPENOCD_HOME)/tcl/interface/ftdi/particle-ftdi.cfg -f $(OPENOCD_HOME)/tcl/target/stm32f2x.cfg  -c "init; reset halt" -c "flash protect 0 0 11 off" -c "program $< $(PLATFORM_DFU) reset exit"
+       $(OPENOCD_HOME)/src/openocd -f $(OPENOCD_HOME)/tcl/interface/ftdi/particle-ftdi.cfg -f $(OPENOCD_HOME)/tcl/target/stm32f2x.cfg  -c "init; reset halt" -c "flash protect 0 0 11 off" -c "program $< $(PLATFORM_DFU) reset exit"
 
 endif

Well, this is somewhat unfortunate, I gave it to a friend and he was able to restart it by doing the same thing as I did, putting it in DFU mode and flash it. We never found the actual problem or the effective solution.

Magic fingers :wink:

1 Like