Programming and debugging the nRF5x on our Developments kits is straight forward. Doing the same when you are using other boards might not be so easy. In this blog post we will explain which components are needed in order to program and debug a nRF5x chip.
The nRF chip is connected to a Debug unit through an interface called "Serial Wire Debug", or "SWD" for short. The debug unit acts as a bridge between the chip and your PC.
It communicates with the programming and debugging software on your PC through a “Debug interface”. Your PC must have a driver for the debug unit and debug interface you are using. The driver allows your PC to recognize the debug unit, and allows communication between them over USB.
When developing applications on a nRF5x Development Kit, you can program it by simply connecting it to your PC with a USB cable.
This is possible because the Development Kit has an on-board debug unit supporting the JLINK debug interface.
Since the on-board debug unit is able to program and debug the on-board chip, it is also able to program any other nRF5x chip.
The Development Kit has headers where you can access the Serial Wire Debug pins. The video below describes how connect these headers to a custom board. You can also see section 5.1 of the nRF51 User Guide for more information about the debug out headers.
If you do not have a nRF5x Development Kit, you can always use a dedicated debug adapter. There exist several manufacturers and debug interfaces. With the nRF5x series, it is common to use JLINK debug adapters from Segger. You can also use debug units using other debug interfaces like the CMSIS-DAP interface, as long as you have the proper drivers and software on your PC.
If you are having any problems, stop by our Developer Zone forum or support portal, where my colleagues and I will do our best to help you out.
When using the Debug in connector P18 to program the on board NRF52 chip U1 from an external programmer, do I need to cut the joining track on SB20,SB21 & SB27 to isolate U2 from U1 in the NRF52DK
Hi Michael, Is it possible to debug the code in custom board?. What exactly I need is as follows. I have put some log information in the code using the NRF_LOG_INFO() function. If I run the code in DK and connect the serial terminal to the correct COM port the messgaes are getting displayed. In a similar way , is it possible to run/debug the code in custom board and get the messages displayed on the serial terminal? If possible what all arrangements/connections should I make?
Hi Anders, you reference a video in your blog but did not provide a link (please can you add this)??
I did find a video on youtube https://www.youtube.com/watch?v=3xilrdYBwwg that I gusee kind of gives me an idea -
Anantha Keshava this may help you with the required connections to tell the JLink programmer to target an external micro
In order to get someone going with the External Debugger, it'll be great if you could show interfacing the nRF5x DK with say a JLINK debug interface by disabling the OB JTAG.
Wonder if the on-board debug chip on the nRF52840-DK has the trace capability ?