beekeeb
  • Home
  • FAQ
  • Layout Testers
  • Keyboards with Cirque Trackpad
  • Allium58 Keyboard
    • Photo logs of installing Allium58 GLP 3D printed keyboard case
  • Cantor Keyboard
  • Chocofi Keyboard
    • Soldering a battery on a Chocofi Wireless
  • Dao Choc BLE Keyboard
  • DASBOB Keyboard
  • FelixKeeb
  • Ferris Sweep Keyboard
  • Hillside Keyboard
  • Hotreus62 Keyboard
  • keezyboost40
  • Piantor Keyboard
    • Quick Start Guide to Build a Piantor (Raspberry Pi Pico)
    • Quick Start Guide to Build a Piantor (WeAct RP2040)
    • Extra Firmwares
  • Pierce Keyboard
  • Stress Fight Pad
  • Swoop Keyboard
  • Thorium Keyboard
  • Yampad Keyboard
  • Zerosprey42 Keyboard
  • Raspberry Pi Pico and Other RP2040 Boards
  • Keyboard Build Guide
    • Avalanche v4.2 Photo Build Log
    • elephant42 Keyboard Photo Build Log
      • elephant42 QMK Firmware with VIA
      • Acrylic Case with Fabric Middle Plates for Split Keyboard Installation
    • Redox v1 (rev 1.0) Build Log
    • Sofle RGB v2.1 SofleKeyboard Photo Build Log
      • Extra Photos for Soldering the RGB LEDs
    • REVIUNG41 Case Installation
    • TOTEM Case Installation
  • Other Guides
    • How to Install display, battery and Test the Wireless Corne Keyboard
    • Installing a Battery to the Ferris Sweep v2
    • Adding nice!view to a Keyboard with a 4-pin OLED Compatible Shield with a Hidden Wire
    • How to Flash a Firmware to USB-C Controller
    • How to Flash a Firmware with OpenOCD
Powered by GitBook
On this page

Was this helpful?

  1. Other Guides

How to Flash a Firmware with OpenOCD

PreviousHow to Flash a Firmware to USB-C Controller

Last updated 2 years ago

Was this helpful?

This is a guide for flashing images for Redox Wireless rev2.0WHS. This should apply to other similar keyboards that uses nRF51.

Clone or download the precompiled images at

Connect a programmer to the board pin header with 3.3V, GND, CLK, IO.

Run

openocd  -f interface/cmsis-dap.cfg  -f target/nrf51.cfg

Replace interface/cmsis-dap.cfg according to the programmer you use. For example, if you use an ST-LINK/V2, you should use interface/stlink-v2.cfg.

The terminal should show

Open On-Chip Debugger 0.11.0
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: JTAG Supported
Info : CMSIS-DAP: FW Version = 2.0.0
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x0bb11477
Info : nrf51.cpu: hardware has 4 breakpoints, 2 watchpoints
Info : starting gdb server for nrf51.cpu on 3333
Info : Listening on port 3333 for gdb connections

Open another terminal and run

telnet localhost 4444

It shows

Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger

So now, we can send commands

init
reset init
flash write_image precompiled/precompiled-basic-left.hex
flash verify_image precompiled/precompiled-basic-left.hex
reset run

The terminal should show

> init
> reset init
target halted due to debug-request, current mode: Thread
xPSR: 0xc1000000 pc: 0x00000bb4 msp: 0x20004000
> flash write_image precompiled/precompiled-basic-left.hex
nRF51822-QFAA(build code: H0) 256kB Flash, 16kB RAM
wrote 15276 bytes from file precompiled/precompiled-basic-left.hex in 1.088257s (13.708 KiB/s)

> flash verify_image precompiled/precompiled-basic-left.hex
verified 15276 bytes from file precompiled/precompiled-basic-left.hex in 0.185782s (80.298 KiB/s)

> reset run

Another way to flash the image is to run

program precompiled/precompiled-basic-left.hex verify reset

The terminal should show

> program precompiled/precompiled-basic-left.hex verify reset
target halted due to debug-request, current mode: Thread
xPSR: 0xc1000000 pc: 0x00000bb4 msp: 0x20004000
** Programming Started **
Adding extra erase range, 0x00003bac .. 0x00003bff
** Programming Finished **
** Verify Started **
** Verified OK **
** Resetting Target **

You should also flash the right side, and the receiver with the respective image file.

If you prefer to flash it without telnet, you can use the -c flag with openocd, so you can flash an image with a one-liner command.

Links

https://github.com/mattdibi/redox-w-firmware
https://openocd.org/doc/html/Flash-Programming.html
https://github.com/mattdibi/redox-w-firmware
https://devzone.nordicsemi.com/f/nordic-q-a/6918/programming-nrf51822-with-openocd-and-stlink-v2-issues