# Photon Corrupted Bootloader

**URL:** <https://community.particle.io/t/photon-corrupted-bootloader/63301>\
**Category:** Hardware\
**Tags:** photon\
**Created:** [October 9, 2022, 3:44pm UTC](https://community.particle.io/t/photon-corrupted-bootloader/63301 "2022-10-09T15:44:45Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrisr777](https://avatars.discourse-cdn.com/v4/letter/c/b5ac83/32.png) [@chrisr777](https://community.particle.io/u/chrisr777)\
**Post date:** [October 9, 2022, 3:44pm UTC](https://community.particle.io/t/photon-corrupted-bootloader/63301/1 "2022-10-09T15:44:45Z")

</div>

I have a light next to D7 and no wifi connectivity light. Support articles say this is a corrupted boot loader. How can I fix that?

---

<div class="post-metadata">

**Author:** ![rickkas7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickkas7/32/8681_2.png) [@rickkas7](https://community.particle.io/u/rickkas7)\
**Post date:** [October 9, 2022, 7:07pm UTC](https://community.particle.io/t/photon-corrupted-bootloader/63301/2 "2022-10-09T19:07:37Z")

</div>

If you are in the Dim D7 state, the bootloader can only be programmed using a SWD/JTAG programmer.

The instructions for a variety of debuggers can be found [here](https://docs.particle.io/reference/developer-tools/jtag/).

---

<div class="post-metadata">

**Author:** ![chrisr777](https://avatars.discourse-cdn.com/v4/letter/c/b5ac83/32.png) [@chrisr777](https://community.particle.io/u/chrisr777)\
**Post date:** [October 9, 2022, 7:24pm UTC](https://community.particle.io/t/photon-corrupted-bootloader/63301/3 "2022-10-09T19:24:44Z")

</div>

Thanks. I found that page, unfortunately I am a software guy, not hardware. I found this post ([Electron Wont boot up](https://community.particle.io/t/electron-wont-boot-up/42439)) which specified which pins to connect to. I looked at an st-link v2 and they come with manufactured cables to plug into a board. since the particle doesn’t have that kind of interface, do I need to build my own with an st-link compatible plug on one end and wires to plug in the bread board on the other? If so do, I use the SWIM connection?

I’m willing to do the leg-work on this but I’m trying to figure out where to start.

---

<div class="post-metadata">

**Author:** ![rickkas7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickkas7/32/8681_2.png) [@rickkas7](https://community.particle.io/u/rickkas7)\
**Post date:** [October 9, 2022, 11:09pm UTC](https://community.particle.io/t/photon-corrupted-bootloader/63301/4 "2022-10-09T23:09:01Z")

</div>

A ST-LINK/V2 clone device is the easiest and cheapest for the Photon or Electron. For SWD mode of the ST-LINK you only need to connect GND, SWDIO to D7 and SWCLK to D6. If you have jumper wires, that is all you need.

---

<div class="post-metadata">

**Author:** ![chrisr777](https://avatars.discourse-cdn.com/v4/letter/c/b5ac83/32.png) [@chrisr777](https://community.particle.io/u/chrisr777)\
**Post date:** [October 22, 2022, 7:00pm UTC](https://community.particle.io/t/photon-corrupted-bootloader/63301/5 "2022-10-22T19:00:59Z")

</div>

> [@rickkas7](#):
>
> to

Hi. I got an emulator, and jump wires. the board is hooked up the the st-link as you instructed and its in DFU mode (blinking yellow). I ran the command

`bin/openocd -s share/openocd/scripts -f share/openocd/scripts/interface/cmsis-dap.cfg -f share/openocd/scripts/target/nrf52-particle.cfg -c "adapter speed 1000" -c "transport select swd" -c "init" -c "flash list" -c "exit"`

from the openocd version folder. I get an error

> `scripts/interface/cmsis-dap.cfg -f share/openocd/scripts/target/nrf52-particle.cfg -c "adapter speed 1000" -c "transport select swd" -c "init" -c "flash list" -c "exit"  
> xPack OpenOCD x86\_64 Open On-Chip Debugger 0.11.0+dev (2022-03-25-17:32)  
> Licensed under GNU GPL v2  
> For bug reports, read  
> [OpenOCD: Bug Reporting](http://openocd.org/doc/doxygen/bugs.html)  
> Info : auto-selecting first available session transport "swd". To override use 'transport select '.  
> DEPRECATED! use 'adapter speed' not 'adapter\_khz'  
> adapter speed: 1000 kHz
> 
> Warn : Transport "swd" was already selected  
> swd  
> Error: unable to find a matching CMSIS-DAP device `

Any suggestions? Please don't tell me my photon is not repairable! 🙂

 ![IMG_0348](https://us1.discourse-cdn.com/flex026/uploads/particle/original/3X/3/4/347cfe55980b86357240e43b959c3267efe00c6f.jpeg)  
 ![IMG_0347](https://us1.discourse-cdn.com/flex026/uploads/particle/original/3X/1/1/11d50480c5a7e7c5a991d3de3423557c03657688.jpeg)

---

<div class="post-metadata">

**Author:** ![rickkas7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickkas7/32/8681_2.png) [@rickkas7](https://community.particle.io/u/rickkas7)\
**Post date:** [October 23, 2022, 3:41pm UTC](https://community.particle.io/t/photon-corrupted-bootloader/63301/6 "2022-10-23T15:41:23Z")

</div>

Those are not the right commands for a ST-LINK/V2 with a Photon. Follow the instructions [here](https://docs.particle.io/reference/developer-tools/jtag/#st-link-clone-usb-stick-with-openocd) instead.

---

<div class="post-metadata">

**Author:** ![chrisr777](https://avatars.discourse-cdn.com/v4/letter/c/b5ac83/32.png) [@chrisr777](https://community.particle.io/u/chrisr777)\
**Post date:** [October 23, 2022, 7:20pm UTC](https://community.particle.io/t/photon-corrupted-bootloader/63301/7 "2022-10-23T19:20:57Z")

</div>

Thanks for the clarification. Here is the complete script I’m running:

```auto
bin/openocd -s share/openocd/scripts/ -f share/openocd/scripts/interface/stlink.cfg -f share/openocd/scripts/target/stm32f2x.cfg -c "adapter speed 1000" -c "transport select swd" -c "init" -c "reset halt" -c "flash protect 0 0 8 off" -c "photon.hex" -c "flash protect 0 0 0 on" -c "flash protect 0 5 8 on" -c "reset" -c "exit"

```

I ran into a couple errors from the original script so I been troubleshooting it. The first was

```auto
C:\OpenOCD\share\openocd\scripts\target\stm32f1x.cfg:6: Error: Can't find target/swj-dp.tcl 
in procedure 'script' 
at file "embedded:startup.tcl", line 60 
at file "C:\OpenOCD\share\openocd\scripts\target\stm32f1x.cfg", line 6 

```

Based on this article [debugging - OpenOCD - Can't find target/swj-dp.tcl - STACKOOM](https://stackoom.com/en/question/2fG70) I added the path: `-s share/openocd/scripts/` which fixed that error.

Now I’m getting ` Error: Can't change session's transport after the initial selection was made` I removed the “transport select” and I get `Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED Error: open failed `

I can’t figure this one out. Any suggestions?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/particle/original/3X/6/4/64635adccc35238caa19e9b553ec3e98b163d026.png) [@system](https://community.particle.io/u/system)\
**Post date:** [November 23, 2022, 5:21am UTC](https://community.particle.io/t/photon-corrupted-bootloader/63301/8 "2022-11-23T05:21:41Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
