SparkFun Forums 

Where electronics enthusiasts find answers.

Open source ARM Debugger
#199862
I would like to flash an nRF52810 board by using OpenOCD running on an Raspberry Pi 1 B Rev2.

I built and installed OpenOCD on my Pi like so:
Code: Select all
git clone https://git.code.sf.net/p/openocd/code openocd-code
cd openocd-code
./bootstrap
./configure --enable-sysfsgpio --enable-bcm2835gpio
make
sudo make install
Between checking out and building I've modified nrf5.c to include this line:
NRF5_DEVICE_DEF(0x0139, "52832", "QFAA", "E0", 512),

I've connected these nRF52810 Pins to those Pi Pins:
Code: Select all
SWDIO <-> GPIO24
SWDCLK <-> GPIO25
P021=RST <-> GPIO18
I'm using this openocd.cfg file:
Code: Select all
source [find interface/raspberrypi-native.cfg]
bcm2835gpio_speed_coeffs 113714 28
bcm2835gpio_swd_nums 25 24
bcm2835gpio_srst_num 18
reset_config srst_only srst_push_pull
transport select swd
set WORKAREASIZE 0
set CHIPNAME nrf52810
source [find target/nrf51.cfg]
reset_config srst_only srst_nogate
adapter_nsrst_delay 100
adapter_nsrst_assert_width 100
init
targets
halt
nrf5 mass_erase
flash write_image feather52_bootloader_v050_s132_v201.hex 0
reset halt
targets
verify_image feather52_bootloader_v050_s132_v201.hex 0
reset run
targets
exit
And I'm getting this output:
Code: Select all
Info : BCM2835 GPIO JTAG/SWD bitbang driver
Info : JTAG and SWD modes enabled
Info : clock speed 1006 kHz
Info : SWD DPIDR 0x01a93070
Info : SWD DPIDR 0x2ba01477
Info : nrf52810.cpu: hardware has 6 breakpoints, 4 watchpoints
Error: nrf52810.cpu -- clearing lockup after double fault
Polling target nrf52810.cpu failed, trying to reexamine
Info : nrf52810.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* nrf52810.cpu       cortex_m   little nrf52810.cpu       halted
Info : nRF52810-QFAA(build code: Bx0) 192kB Flash
Error: Failed to erase reg: 0x4001e50c val: 0x00000001
Error: Failed to erase the chip
Trying to flash without the mass erase gives this output:
Code: Select all
Info : nRF52810-QFAA(build code: Bx0) 192kB Flash
Info : Padding image section 0 at 0x00000964 with 1692 bytes
Warn : not enough working area available(requested 32)
Warn : no working area available, falling back to slow memory writes
Warn : no flash bank found for address 0x00074000
Warn : not enough working area available(requested 36)
Running slow fallback erase check - add working memory
Warn : not enough working area available(requested 32)
Warn : no working area available, falling back to slow memory writes
wrote 112336 bytes from file feather52_bootloader_v050_s132_v201.hex in 11.031472s (9.945 KiB/s)
target halted due to debug-request, current mode: Handler HardFault
xPSR: 0x01000003 pc: 0xfffffffe msp: 0xffffffd8
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* nrf52810.cpu       cortex_m   little nrf52810.cpu       halted
Warn : not enough working area available(requested 52)
Warn : not enough working area available(requested 52)
Warn : not enough working area available(requested 52)
Error: checksum mismatch - attempting binary compare
diff 0 address 0x00074000. Was 0x00 instead of 0x80
diff 1 address 0x00074001. Was 0x00 instead of 0x7f
...
diff 127 address 0x000740c5. Was 0x00 instead of 0x94
More than 128 errors, the rest are not printed.
Can you help me?

On the nordicsemi forum an engineer told me OpenOCD only supports the nRF52832 chip and not the nRF52810 and I need to use an SEGGER debugger instead. But I figured those two chips are almost the same and adding support shouldn't involve too much of a hassle. Can you tell me what needs to be done? On the same forum there is a post that reads like other people have already figured it out: https://devzone.nordicsemi.com/f/nordic ... spberry-pi