Hi, I have a BMD-300 (nRF52) module that I'm attempting to program with OpenOCD and an ST-link from Linux (it worked great for nRF51 so I was trying to keep the same tools).
$OPENOCD/src/openocd -s $OPENOCD/tcl -f interface/stlink-v2.cfg -f target/nrf52.cfg -c init -c "reset init" -c halt -c "nrf52 mass_erase" -c "program $FIRMWARE verify" -c reset -c exit
I'm using OpenOCD from here: github.com/.../openocd
And it says:
Open On-Chip Debugger 0.10.0-dev-00282-gbd6642f (2016-05-09-13:36) Licensed under GNU GPL v2 For bug reports, read openocd.org/.../bugs.html Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'. Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD adapter speed: 10000 kHz Info : Unable to match requested speed 10000 kHz, using 4000 kHz Info : Unable to match requested speed 10000 kHz, using 4000 kHz Info : clock speed 4000 kHz Info : STLINK v2 JTAG v14 API v2 SWIM v0 VID 0x0483 PID 0x3748 Info : using stlink api v2 Info : Target voltage: 3.787037 Info : nrf52.cpu: hardware has 0 breakpoints, 2 watchpoints Error: timed out while waiting for target halted TARGET: nrf52.cpu - Not halted in procedure 'reset' in procedure 'ocd_bouncer'
It definitely knows the chip is connected and can read the chip ID off it, as it comes up with different errors with the chip connected and trying to flash with the nrf51 code returns:
Warn : UNEXPECTED idcode: 0x2ba01477 Error: expected 1 of 1: 0x0bb11477
Do you have any ideas what the problem might be? Error: timed out while waiting for target halted seems like the issue, but I'm not sure how to fix it... As I say, this worked (connecting SWCLK, SWDIO, GND and using target power) on nRF51 just fine. Could it be to do with the BMD-300's existing bootloader?
Error: timed out while waiting for target halted
Hi,
I work from a few day with openOCD to program and debug on nRF52. For this I'm using a patched version of openocd.
1 - Clone openocd from git from sourceforge.net/.../
git clone git://git.code…
This seems to be because Rigado set the memory protection bit.
Thanks to Rigado's support, it seems you can do nrfjtool --recover to remove this (or you can manually poke the relevant registers).
nrfjtool --recover
This problem has probably been solved already, but for those peaple who will stumble here while struggling with their own version of the same, don't forget to check whether the instance of "openocd" you…
As it happens you can program an nRF52 from the nRF52DK by connecting it up to P20. The devkit switches over automatically (no jumpers needed). nrfjtool is also available for Linux now, so there's very little reason (IMO) to have to use OpenOCD now.
nrfjtool
Of course it still doesn't work for me after all that, but I've created a new issue for that as it appears that OpenOCD would have worked, if it weren't for the memory protection bit being set.
New issue: devzone.nordicsemi.com/.../
git clone git://git.code.sf.net/p/openocd/code openocd-code cd openocd-code
2 - Apply patch for nrf52 : openocd.zylin.com/
git pull openocd.zylin.com/openocd refs/changes/15/3215/2
If need merge conflict manually
gedit src/flash/nor/drivers.c gedit src/flash/nor/Makefile.am
3 - Build OpenOCD (change prefix) :
./bootstrap # (when building from the git repository) ./configure \ --prefix=/Your-path/openocd-git_install \ --enable-aice \ --enable-amtjtagaccel \ --enable-armjtagew \ --enable-cmsis-dap \ --enable-dummy \ --enable-ftdi \ --enable-gw16012 \ --enable-jlink \ --enable-jtag_vpi \ --enable-opendous \ --enable-openjtag_ftdi \ --enable-osbdm \ --enable-legacy-ft2232_libftdi \ --enable-parport \ --disable-parport-ppdev \ --enable-parport-giveio \ --enable-presto_libftdi \ --enable-remote-bitbang \ --enable-rlink \ --enable-stlink \ --enable-ti-icdi \ --enable-ulink \ --enable-usb-blaster-2 \ --enable-usb_blaster_libftdi \ --enable-usbprog \ --enable-vsllink make make install
4 - Create a new board_nrf52.cfg config file with :
source [find interface/jlink.cfg] transport select swd source [find target/nrf52.cfg]
5 - Debug !
openocd -s /Your-path/openocd-git_install/share/openocd/scripts/ -f board_nrf52.cfg -c init -c "reset init" -c halt -c "nrf52 mass_erase" -c "program _build/nrf52832_xxaa.out verify" -c reset -c exit
Hello, I have followed the steps you have posted, But when I flash my nrf52832 board I find following errors:
Preparing: _build/nrf51422_xxac.hex Flashing: _build/nrf51422_xxac.hex /home/ac2/test_nrf52/openocd-code/src/openocd -s /home/ac2/test_nrf52/openocd-code/tcl -f /home/ac2/test_nrf52/openocd-code/board_nrf52.cfg -c init -c "reset init" -c halt -c "nrf52 mass_erase" -c "program _build/nrf51422_xxac.hex verify" -c reset -c exit Open On-Chip Debugger 0.10.0-dev-00419-gbcaf775-dirty (2016-11-29-13:32) Licensed under GNU GPL v2 For bug reports, read openocd.org/.../bugs.html Error: flash driver 'nrf52' not found Makefile:182: recipe for target 'flash' failed make: *** [flash] Error 1
Can you help me figure out which steps I am missing?
Possible that the patch (which that add nrf52 target) has not been correctly applied...
Even I am facing similar issue. As suggested by ubicore I checked that patch related to nrf52 target is correctly applied. Following is the error,
MS-7817:~/workarea/Projects/ble_door_lock/open/openocd-code$ openocd -s /home/ac1/workarea/Projects/ble_door_lock/open/openocd-code/ -f board_nrf52.cfg -c init -c "reset init" -c halt -c "nrf52 mass_erase" -c "program blinky_pca10031.hex verify" -c reset -c exit Open On-Chip Debugger 0.10.0-dev-00419-gbcaf775-dirty (2016-11-30-17:06) Licensed under GNU GPL v2 For bug reports, read openocd.org/.../bugs.html Error: The specified debug interface was not found (hla) The following debug interfaces are available:
PS: But it does not show any interfaces under 'following interfaces are available'. Although we have installed, STlink 'github.com/.../compiling.md', since we are using ST LinkV2 progammer for programming nrf52 module