1
votes

I am try to program or upload code to a nrf51822 breakout board using st link v2 mini with openocd. I have been following the blog post tutorial of http://icarus-sensors.github.io/general/starting-with-nRF51822.html. However, i couldnt get the connect to the device using openocd. Error message is attached below. Any idea what is wrong? Or, is that any other easy way i can program the nrf51?

openocd -f interface/stlink-v2.cfg -f target/nrf51.cfg

GNU ARM Eclipse 64-bits Open On-Chip Debugger 0.9.0-00073-gdd34716-dirty (2015-05-19-09:55) 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 '. 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 v25 API v2 SWIM v4 VID 0x0483 PID 0x3748 Info : using stlink api v2 Info : Target voltage: 3.268965 Error: init mode failed (unable to connect to the target) in procedure 'init' in procedure 'ocd_bouncer'

nrf51822 breakout : http://www.newegg.com/Product/Product.aspx?Item=9SIA7BF37Z1712&nm_mc=OTC-Froogle&cm_mmc=OTC-Froogle--Gadgets--Srad+Tech-_-9SIA7BF37Z1712

st link v2 mini : http://www.electrodragon.com/product/st-link-v2-programmer-for-stm8-stm32/

1

1 Answers

1
votes

The important message from openocd is: "unable to connect to the target".

It means that openocd has successfully connected with ST-Link, but connection between ST-Link and nRF51822 was not successful.

There can be many reasons causing that:

  • Incorrect connection between ST-Link and nRF51822 (wrong pins, bad connection between wires and pins, damaged wires, maybe even too long wires)
  • If the chip uses external power supply, it can be a problem with the supply (you usually also have to connect ground pin of ST-Link with ground pin on external supply even if not using ST-Link to power the chip while flashing)
  • Faulty ST-Link (I've damaged one by mistankingly connecting ST-Link to external voltage on my breadboard)
  • Faulty nRF51822