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

Unable to connect to NRF51822 with OpenOCD and STLink/V2 via SWD

Hello,

I have some MDBT40 modules from Raytac that are blank. I want to flash some code (anything at this point) using the STLink/V2 programmer, SWD interface, and OpenOCD 0.9.0 (Windows). I've attempted to follow several online resources that accomplish my goal:

icarus-sensors.github.io/.../starting-with-nRF51822.html exploreembedded.com/.../Programming_nRF51822_with_STlink_on_Windows

All my attempts have failed and leads to the familiar error from OpenOCD (error is bolded):

Info : auto-selecting first available session transport "hla_swd". To override use 'transport select '. Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD adapter speed: 1000 kHz Info : Unable to match requested speed 1000 kHz, using 950 kHz Info : Unable to match requested speed 1000 kHz, using 950 kHz Info : clock speed 950 kHz Info : STLINK v2 JTAG v24 API v2 SWIM v4 VID 0x0483 PID 0x3748 Info : using stlink api v2 Info : Target voltage: 3.214737 Error: init mode failed (unable to connect to the target) in procedure 'init' in procedure 'ocd_bouncer'

What I've tried:

  1. Verified connections from the SWD STLink/V2 to the device I have, according to the second link above.
  2. Updating STLink/V2 firmware to the latest from ST site. I'm at 2.24.4
  3. Made sure that there is an external working clock at 32KHz.
  4. Tried both STM8 and STM32 from the STLink/V2.
  5. Changed the driver to LibUSB, and LibUSBk (tried both) using Zadig v2.2
  6. Tried to connect using the STLink Utility, using the "Hardware Reset" mode, with "Connect Under Reset", using all of the SWD speeds shown.
  7. Scoped the SWCLK/SWDIO during my attempts to program using OpenOCD -> Both pins are always high when STLink/V2 is connected to the device: I have no clue why I don't see any activity happening here during a connection attempt. Number 6 led me to believe that the STLink/V2 is waiting for some kind of reset, which led me to: sourceforge.net/.../ but unfortunately this didn't give any suggestions that looked promising.
  8. A different MDBT40 module, just in case this one was damaged.

I've also looked through the forum but did not find anything that fixes my issue. If anyone has any ideas on how to fix this, that would be really appreciated!

Thanks, Robert

Related