nRF51-DK as Debugger/Programmer
The nRF51 DK board supports programming and debugging of external boards. The idea is to use the built-in JTAG adapter for external programming of the Metawear. Of course, this feature can be generally used with other ARM chips supported by JLink. To debug an external board, use the Debug out (P19 or P20).
![](https://i0.wp.com/turlucode.com/wp-content/uploads/2017/06/nRF51-Debug_Out.png?fit=1024%2C459&ssl=1)
In this guide we will use the P19 Debug-Out port, as it allows us to create easier and straight-forward a custom cable to interface with the Metawear RG.
Hardware and part-list
nRF51-DK:
The Debugger/Programmer
![](https://i0.wp.com/turlucode.com/wp-content/uploads/2017/06/nRF51-DK_small.png?fit=250%2C156&ssl=1)
Metawear RG:
The external board
![](https://i0.wp.com/turlucode.com/wp-content/uploads/2017/06/metawear_nrf51822.png?fit=186%2C121&ssl=1)
Cable Part-List
Part | Item-Number | Image | Price € |
Male Header | S9012E-02-ND | ![]() ![]() |
0.56 |
Flat Ribbon Cable .050″ | ME10G-5-ND | ![]() ![]() |
2.64 |
Socket .050″ 10POS | M50-3300542 | ![]() ![]() |
2.01 |
Socket .050″ 4POS | 3M15519-ND | ![]() ![]() |
3.59 |
Total: | 8.8€ | ||
Click for Cart-Share (Digikey EU) |
Well, one can rightfully argue that 8.8€ is not a cheap solution, but at the time I was experimenting with this, I could only find these kind of connectors. I would more than happy if someone can point out a more affordable solution.
Synthesizing the Cable
To figure out how to correctly create the cable see the figure below:
Is obvious that we are only interested in 4 pins from the Debug-out port
- EXT_VTG
- EXT_SWDIO
- GND
- EXT_SWCLK
However the EXT_GND_DETECT is also important as it is used by the Jlink chip to detect if an external board is connected. More specifically, the EXT_VTG is low and EXT_GND_DETECT is high by default when nothing is connected to P20 and that is how JLink chip senses the presence of the external board. The below figure shows how to map the pins to the cable/connectors.