{"id":833,"date":"2015-09-17T21:26:27","date_gmt":"2015-09-18T04:26:27","guid":{"rendered":"http:\/\/visualgdb.com\/w\/?p=833"},"modified":"2015-09-18T11:17:09","modified_gmt":"2015-09-18T18:17:09","slug":"debugging-nordic-nrf51822-beacon-kit-firmware","status":"publish","type":"post","link":"https:\/\/visualgdb.com\/tutorials\/arm\/nrf51\/beacon-kit\/","title":{"rendered":"Debugging Nordic nRF51822 Beacon Kit Firmware"},"content":{"rendered":"<p>This tutorial shows how to build and debug Bluetooth LE beacon firmware for the <a href=\"https:\/\/www.nordicsemi.com\/eng\/Products\/Bluetooth-Smart-Bluetooth-low-energy\/nRF51822-Bluetooth-Smart-Beacon-Kit\">nRF51 Beacon Kit<\/a>. We will use <a href=\"https:\/\/www.segger.com\/jlink-debug-probes.html\">Segger J-Link<\/a> together with a <a href=\"http:\/\/www.tag-connect.com\/\">Tag Connect cable<\/a> 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.<\/p>\n<p>Before you begin, install Visual Studio and VisualGDB 5.0 or later.<\/p>\n<ol>\n<li>Launch Visual Studio and open the VisualGDB Embedded Project wizard:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/01-wizard.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-834\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/01-wizard.png\" alt=\"01-wizard\" width=\"800\" height=\"497\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/01-wizard.png 800w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/01-wizard-300x186.png 300w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/a><\/li>\n<li>Proceed with the default settings on the first page:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/02-newbin.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-835\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/02-newbin.png\" alt=\"02-newbin\" width=\"702\" height=\"571\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/02-newbin.png 702w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/02-newbin-300x244.png 300w\" sizes=\"(max-width: 702px) 100vw, 702px\" \/><\/a><\/li>\n<li>Select the ARM toolchain and pick the <strong>nRF51822_XXAA<\/strong> device. Then select the S110 softdevice: <a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/04-nrf_device.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-837\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/04-nrf_device.png\" alt=\"04-nrf_device\" width=\"702\" height=\"631\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/04-nrf_device.png 702w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/04-nrf_device-300x270.png 300w\" sizes=\"(max-width: 702px) 100vw, 702px\" \/><\/a><\/li>\n<li>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):<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/05-beacon.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-838\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/05-beacon.png\" alt=\"05-beacon\" width=\"702\" height=\"631\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/05-beacon.png 702w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/05-beacon-300x270.png 300w\" sizes=\"(max-width: 702px) 100vw, 702px\" \/><\/a><\/li>\n<li>Select Segger J-Link as the debug method and check the &#8220;Reset device after programming&#8221; checkbox:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/06-debugmtd.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-839\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/06-debugmtd.png\" alt=\"06-debugmtd\" width=\"702\" height=\"631\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/06-debugmtd.png 702w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/06-debugmtd-300x270.png 300w\" sizes=\"(max-width: 702px) 100vw, 702px\" \/><\/a><\/li>\n<li>Once the project is created, build it with Ctrl-Shift-B:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/07-build.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-840\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/07-build.png\" alt=\"07-build\" width=\"699\" height=\"605\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/07-build.png 699w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/07-build-300x260.png 300w\" sizes=\"(max-width: 699px) 100vw, 699px\" \/><\/a><\/li>\n<li>Connect the Tag Connect TC2030-IDC-NL cable to the beacon kit as shown below:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/connect.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-842\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/connect.jpg\" alt=\"connect\" width=\"700\" height=\"263\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/connect.jpg 700w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/connect-300x113.jpg 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a><\/li>\n<li>Connect the other end of the cable to your Segger J-Link probe using the <a href=\"http:\/\/www.tag-connect.com\/JLINK\">ARM20-CTX<\/a> adapter:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/jlink.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-843\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/jlink.jpg\" alt=\"jlink\" width=\"700\" height=\"309\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/jlink.jpg 700w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/jlink-300x132.jpg 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a><\/li>\n<li>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-&gt;WEN to 10 and then setting the ERASEALL bit in the Hardware Registers window:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/08-erase.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-841\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/08-erase.png\" alt=\"08-erase\" width=\"699\" height=\"664\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/08-erase.png 699w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/08-erase-300x285.png 300w\" sizes=\"(max-width: 699px) 100vw, 699px\" \/><\/a>If you erase the FLASH, hit Shift-F5 and then F5 again to actually program the new firmware.<\/li>\n<li>Once the program is running, open the Beacons tab of Nordic nRF51 toolbox on your Android device:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/08\/08-addbeacon.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-407\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/08\/08-addbeacon.png\" alt=\"08-addbeacon\" width=\"700\" height=\"394\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/08\/08-addbeacon.png 700w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/08\/08-addbeacon-300x169.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a><\/li>\n<li>Click &#8220;Add&#8221; and wait until your phone discovers the beacon:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/08\/09-beacon.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-408\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/08\/09-beacon.png\" alt=\"09-beacon\" width=\"700\" height=\"394\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/08\/09-beacon.png 700w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/08\/09-beacon-300x169.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a>Now you can modify the beacon firmware and quickly test it out by pressing F5 in Visual Studio. See <a href=\"http:\/\/visualgdb.com\/tutorials\/arm\/nrf51\/beacon\/\">this tutorial<\/a> for an example of modifying the major and minor IDs.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows how to build and debug Bluetooth LE beacon firmware for the nRF51 Beacon Kit. We will use<\/p>\n","protected":false},"author":1,"featured_media":844,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[96,56,95],"_links":{"self":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/833"}],"collection":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/comments?post=833"}],"version-history":[{"count":4,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/833\/revisions"}],"predecessor-version":[{"id":850,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/833\/revisions\/850"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/media\/844"}],"wp:attachment":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/media?parent=833"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/categories?post=833"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/tags?post=833"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}