Debugging Nordic nRF51822 Beacon Kit Firmware

This tutorial shows how to build and debug Bluetooth LE beacon firmware for the nRF51 Beacon Kit. We will use Segger J-Link together with a Tag Connect cable to debug the beacon. We will show how to use an Android phone with the Nordic nRF Toolbox App to search for the nearby beacons.

Before you begin, install Visual Studio and VisualGDB 5.0 or later.

  1. Launch Visual Studio and open the VisualGDB Embedded Project wizard:01-wizard
  2. Proceed with the default settings on the first page:02-newbin
  3. Select the ARM toolchain and pick the nRF51822_XXAA device. Then select the S110 softdevice: 04-nrf_device
  4. On the next page select the Bluetooth LE Beacon sample and choose the PCA20006 board (the beacon kit board number is PCA10006, but the Nordic SDK does not include definition for it, so we choose a similar PCA200006 board):05-beacon
  5. Select Segger J-Link as the debug method and check the “Reset device after programming” checkbox:06-debugmtd
  6. Once the project is created, build it with Ctrl-Shift-B:07-build
  7. Connect the Tag Connect TC2030-IDC-NL cable to the beacon kit as shown below:connect
  8. Connect the other end of the cable to your Segger J-Link probe using the ARM20-CTX adapter:jlink
  9. Now you can press F5 to start debugging. If the program does not start, you may need to manually erase the chip to override the FLASH lock bits. This can be done by setting NVMC->WEN to 10 and then setting the ERASEALL bit in the Hardware Registers window:08-eraseIf you erase the FLASH, hit Shift-F5 and then F5 again to actually program the new firmware.
  10. Once the program is running, open the Beacons tab of Nordic nRF51 toolbox on your Android device:08-addbeacon
  11. Click “Add” and wait until your phone discovers the beacon:09-beaconNow you can modify the beacon firmware and quickly test it out by pressing F5 in Visual Studio. See this tutorial for an example of modifying the major and minor IDs.