openocd - problem flashing nrf52 using stlink


I've got some issues flashing firmware using an STLINKv2 (from a Nucleo board) with an nRF52 target device using SWD. In short, I'm able to "connect" to the nRF52 (I can open a telnet session), but as soon as I try a Program command, I get a non-helpful error (below). Hex file is compiled using Arduino "export bin" file option. (Using a SEGGER isn't an option right now)

More details below:

OSX version 10.14.6, OpenOCD version 0.10.0.

Running in terminal openocd -f interface/stlink-v2-1.cfg -f target/nrf52.cfg returns:

Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
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 v28 API v2 SWIM v17 VID 0x0483 PID 0x374B
Info : using stlink api v2
Info : Target voltage: 0.014192
Error: target voltage may be too low for reliable debugging
Info : nrf52.cpu: hardware has 6 breakpoints, 4 watchpoints

I can then telnet in using telnet localhost 4444:

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

In telnet, I can run basic commands on the nRF52, and when I execute: program /full/path/to/hex/file.hex I get the following message:

target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
** Programming Started **
embedded:startup.tcl:476: Error: ** Programming Failed **
in procedure 'program' 
in procedure 'program_error' called at file "embedded:startup.tcl", line 532
at file "embedded:startup.tcl", line 476

Would love to know what I'm doing wrong!

ETA: The voltage error is not related; that was due to a bug in the Nucleo SWD programmer hardware one has to solder a jumper wire from the VDD-TARGET to the outward pin of R24. (When you break off the Nucleo from the STLINK board, you break off this link) Have done that, however the problem persists.

asked on Stack Overflow Oct 13, 2019 by pinchy • edited Oct 15, 2019 by pinchy

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0