Programmer shield on windows plus using workbench

Using programmer Shield and the workbench to load the bootloader on photon

@rickkas7

I will appreciate a step by step method for using the workbench with programmer shield to load bootloader on the photon.
The boatloader has been downloaded and the workbench properly set.
I am new to it. Please guide me. Thanks.

The Photon Programmer Shield is no longer supported but this will probably work:

Copied from this page but changed the interface script path.

Find openocd

In your home directory there is a hidden directory .particle, which contains toolchains, then openocd, then a version directory. At the time of writing this was 0.11.2-adhoc6ea4372.0 but this may change in future Workbench updates.

For example:


$ cd ~/.particle/toolchains/openocd/0.11.2-adhoc6ea4372.0

The commands below assume you will be in that directory to execute the command. For example:


$ bin/openocd -f share/openocd/scripts/interface/particle-ftdi.cfg -f share/openocd/scripts/target/stm32f2x.cfg -c "adapter_khz 1000" -c "transport select swd" -c "init" -c "flash list" -c "exit"

When positioned in the openocd version directory above, this command will flash a Gen 2 device:


$ bin/openocd -f share/openocd/scripts/interface/particle-ftdi.cfg -f share/openocd/scripts/target/stm32f2x.cfg -c "adapter_khz 1000" -c "transport select swd" -c "init" -c "reset halt" -c "flash protect 0 0 8 off" -c "program /Users/rick/Downloads/photon.hex" -c "flash protect 0 0 0 on" -c "flash protect 0 5 8 on" -c "reset" -c "exit"

Make sure you replace /Users/rick/Downloads/photon.hex with the actual path to your file. It must be an absolute path, because of the way the parameter is passed to openocd. The restore binaries are here.

What this does:

Command Notes
bin/openocd Runs openocd
-f share/openocd/scripts/interface/particle-ftdi.cfg Debugger configuration file for Programmer Shield
-f share/openocd/scripts/target/stm32f2x.cfg Configuration file for MCU (STM32F2xx)
-c "adapter_khz 1000" Adapter speed
-c "transport select swd" Use SWD mode
-c "init" Initialize adapter
-c "reset halt" Reset and halt the MCU
-c "flash protect 0 0 8 off" Disable write protection on bootloader and system
-c "program /Users/rick/Downloads/photon.hex" Write the hex file to the Particle device
-c "flash protect 0 0 0 on" Enable write protection on bootloader
-c "flash protect 0 5 8 on" Enable write protection on the Device OS
-c "reset" Reset the Particle device after flashing
-c "exit" Exit openocd

Gen 2 Device Security Bit Error

If you get a Device Security Bit Error when reprogramming a device, you will need to issue the following command, then flash the hex file as above.


$ bin/openocd -f share/openocd/scripts/interface/particle-ftdi.cfg -f share/openocd/scripts/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"

What this does:

Command Notes
bin/openocd Runs openocd
-f share/openocd/scripts/interface/particle-ftdi.cfg Debugger configuration file for Programmer Shield
-f share/openocd/scripts/target/stm32f2x.cfg Configuration file for MCU (STM32F2xx)
-c "adapter_khz 1000" Adapter speed
-c "transport select swd" Use SWD mode
-c "init" Initialize adapter
-c "reset halt" Reset and halt the MCU
-c "stm32f2x unlock 0" Set the STM32 RDP (readout protection level) to 0
-c "reset halt" Reset and halt the MCU
-c "exit" Exit openocd

After setting the RDP level you will have to flash the firmware restore above, as well as reset the device keys. The easiest way to do that is to use particle keys doctor.

Thank you sir

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