How to Flash firmware into bluz using ST Link V2


Hi, I want to flash firmware into my bluz. I am using ST Link V2 as an external programmer to do this. But the St Link utility software is not able to detect the target bluz. I have doubt on my hardware connections. Can anyone tell me about the whole process ?

Thanks in Advance :slight_smile:


We use a library called Adalink by Adafruit. It uses OpenOCD to program the nrf51 over the STLink.

You can get the library, along with installation instructions, here:

Then it is as simple as:

adalink nrf51822 --programmer jlink --program-hex system/system-part1.hex --program-hex user-part/tinker.hex


Hi Eric,

I followed the instructions as given in the link Whenever I am running the adalink command, I am getting the following error

C:\Users\08sha>adalink --help
Traceback (most recent call last):
File “C:\Users\08sha\AppData\Local\Programs\Python\Python36\Scripts\”, line 9, in
load_entry_point(‘adalink==2.4.1’, ‘console_scripts’, ‘adalink’)()
File “C:\Users\08sha\AppData\Local\Programs\Python\Python36\lib\site-packages\setuptools-3.5.1-py3.6.egg\”, line 351, in load_entry_point
File “C:\Users\08sha\AppData\Local\Programs\Python\Python36\lib\site-packages\setuptools-3.5.1-py3.6.egg\”, line 2363, in load_entry_point
File “C:\Users\08sha\AppData\Local\Programs\Python\Python36\lib\site-packages\setuptools-3.5.1-py3.6.egg\”, line 2088, in load
File “c:\users\08sha\adafruit_adalink\adalink\”, line 44, in
from .cores import *
File “c:\users\08sha\adafruit_adalink\adalink\”, line 12, in
import atsamd21g18
ImportError: No module named ‘atsamd21g18’

Please let me know, how to proceed…


What OS are you using? Mac, Windows, Linux?

Which installation option did you try? There are several options to choose from in the instructions. Did you install OpenOCD?


I am using Windows. I tried all the 3 methods one by one. In all of them , whenever I am running an adalink command, I am getting the same error.


What version of python are you using?


I am using python 3.5.2


I’ve never had or seen success using the library with Python 3.X. You may want to try downgrading to Python 2.7 unless you have a compelling reason not to.

This is a third party library as well, so we don’t maintain or support it directly. You could try opening a ticket with them or contacting the owner to see if they can help as well.