This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Programming nRF51822 using SWD

We are using nRF51822 in our custom board. We just remain two pin ------ SCLK and SWDIO Can we programming by STLink ? what's the step? 1.using nrfgo studio to programming SoftDevice 2.using keil to download? thanks!

Parents
  • I use Eclipse with GCC, GDB and OpenOCD to program the nrf51 using the ST-Link/V2.

    To flash the SoftDevice using OpenOCD and any compatible Jtag (tested with ST-Link/V2), you can do:

    $ openocd -f interface/stlink-v2.cfg -c "transport select hla_swd; set WORKAREASIZE 0x4000;" -f target/nrf51.cfg -c "init ; reset halt ; nrf51 mass_erase ; sleep 500 ; flash write_image .bin 0x0 ; verify_image .bin 0x0 ; mww 0x4001e504 1 ; mww 0x10001000 $(STARTADDRESS) ; mww 0x4001e504 0 ; shutdown"

    The application start address depends on the SoftDevice you use. The address value is given in the SoftDevice release notes (0x16000 for s110 v. 7.3.0 for instance). Do not forget to change your linker script with this offset value.

    Have a look at this Makefile to see other targets to program your application or to erase the flash.

    Regards, Christopher

Reply
  • I use Eclipse with GCC, GDB and OpenOCD to program the nrf51 using the ST-Link/V2.

    To flash the SoftDevice using OpenOCD and any compatible Jtag (tested with ST-Link/V2), you can do:

    $ openocd -f interface/stlink-v2.cfg -c "transport select hla_swd; set WORKAREASIZE 0x4000;" -f target/nrf51.cfg -c "init ; reset halt ; nrf51 mass_erase ; sleep 500 ; flash write_image .bin 0x0 ; verify_image .bin 0x0 ; mww 0x4001e504 1 ; mww 0x10001000 $(STARTADDRESS) ; mww 0x4001e504 0 ; shutdown"

    The application start address depends on the SoftDevice you use. The address value is given in the SoftDevice release notes (0x16000 for s110 v. 7.3.0 for instance). Do not forget to change your linker script with this offset value.

    Have a look at this Makefile to see other targets to program your application or to erase the flash.

    Regards, Christopher

Children
No Data
Related