Skip to content

plentypvp/NRF52840-Cheap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

NRF52840-Cheap

A cheap way for NRF52840 development. Uses inexpensive ST-Link V2 USB in-circuit debugger.

  1. Buy this board: https://wiki.makerdiary.com/nrf52840-mdk-usb-dongle/
    Or make another yourself according to reference circuitry on Nordic Semiconductor website.
  2. Buy ST-Link V2 USB debugger.
  3. Connect SWDIO, SWDCLK and GND pins. Power up the target.
  4. Install all from: https://wiki.makerdiary.com/nrf52840-mdk/nrf5-sdk/
  5. OpenOCD from: https://4k2.de/microcontroller/openocd-flashing-nrf52/
git clone https://git.code.sf.net/p/openocd/code openocd    
cd openocd    
./bootstrap    
mkdir build; cd build    
../configure --enable-cmsis-dap --enable-openjtag --prefix=/opt/openocd    
make    
sudo make install
  1. We are NRF52840 (PCA10059 S140), use that hex in examples.

  2. Type:
    openocd -f interface/stlink-dap.cfg -f target/nrf52.cfg -c "telnet_port pipe;tcl_port disabled;gdb_port disabled;log_output /dev/null"

  3. And use following commands:

nrf52.dap apreg 1 0x04 1    
init    
reset halt    
nrf52.dap apreg 1 0x04 1    
nrf5 mass_erase    
program /home/plentypvp/nRF5_SDK_17.1.0_ddde560/examples/ble_peripheral/ble_app_blinky/hex/ble_app_blinky_pca10059_s140.hex verify    
reset    
  1. Test again with:
    openocd -f interface/stlink-dap.cfg -f target/nrf52.cfg -c "init" -c "nrf52_recover" -c "reset halt" -c "nrf5 mass_erase" -c "program /home/plentypvp/nRF5_SDK_17.1.0_ddde560/examples/ble_peripheral/ble_app_blinky/hex/ble_app_blinky_pca10059_s140.hex verify" -c "reset" -c "exit"

  2. Brick it with:
    openocd -f interface/stlink-dap.cfg -f target/nrf52.cfg -c "init" -c "reset halt" -c "nrf5 mass_erase" -c "program /home/plentypvp/nRF5_SDK_17.1.0_ddde560/examples/ble_peripheral/ble_app_gatts_c/hex/ble_app_gatts_c_pca10056_s140.hex verify" -c "reset" -c "exit"

  3. Unbrick with step 7.

  4. Go to:
    nRF5_SDK_17.1.0_ddde560/examples/ble_peripheral/ble_app_blinky/pca10059/s140/armgcc

  5. And type:
    make

  6. Flash with:
    openocd -f interface/stlink-dap.cfg -f target/nrf52.cfg -c "init" -c "nrf52_recover" -c "reset halt" -c "nrf5 mass_erase" -c "program /home/plentypvp/nRF5_SDK_17.1.0_ddde560/components/softdevice/s140/hex/s140_nrf52_7.2.0_softdevice.hex" -c "program /home/plentypvp/nRF5_SDK_17.1.0_ddde560/examples/ble_peripheral/ble_app_blinky/pca10059/s140/armgcc/_build/nrf52840_xxaa.hex verify" -c "reset" -c "exit"

(For compiled app with softdevice)

Tested on Ubuntu 22.04.1 LTS

About

Cheap development for NRF52840 Wireless MCU

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published