3

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
http://openocd.org/doc/doxygen/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 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
Trying 127.0.0.1...
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.

3
  • Error: target voltage may be too low for reliable debugging The nrf52.cfg probably doesnt configure the programmer to supply power, and your board is (barely) running on whatever leakage current is provided by the SWD connection. The program command might trigger a flash erase for which you dont have enough power, your device brown-outs and openOCD gives an error.
    – markus-nm
    Oct 14, 2019 at 12:00
  • Yep good pick up! 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. Of note, I've managed to flash code using Platformio using the same hardware, however when I try and use CLI openocd, I get the same error above.
    – pinchy
    Oct 15, 2019 at 2:28
  • i think the arduino stack page is better for type of questions arduino.stackexchange.com Jul 10, 2020 at 6:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.