- 
                Notifications
    You must be signed in to change notification settings 
- Fork 592
Flashing nRF with OpenOCD ST Link
Some nRF chips in a small form factor need to be flashed manually. Either by using a J-Link (which can be expensive) or a cheaper ST-Link in combination with openocd.
- 
Connect the pins to the correct ST-Link pins. A sample schematic of an nRF52 Beacon can be found below 
- 
Build your firmware with the correct keys 
- 
Run openocdwith the correct configurationopenocd -f share/openocd/scripts/interface/stlink.cfg -f share/openocd/scripts/target/nrf52.cfg The first parameter here uses the configuration file for the connected interface (stlink-v2) and the second parameter loads the config file for the nrf52 boards 
- 
Now openocdis running. You can connect to it using telnet:telnet localhost 4444 You can get all available commands using the helpcommand
- 
Stop the execution with halt
- 
You can backup the existing firmware: dump_image /Your/File/Path/flash.bin 0 0x40000`
- 
Erase the flash using nrf5 mass_erase 
- 
Verify and program your device by using (use the .bin not .hex file) program /your/path/to/the/firmware.bin verify program /your/path/to/the/firmware.bin 
- 
Resume the execution 
resume