Dependencies:
-
nRF51822 mbed kit with product key (contact technical support if it was not written on the mbed kit package)
This blog post will not take installation of above dependencies into consideration.
Configuring a project for CMSIS-DAP debugger:
-
Open a project in Keil, and go to Options for Target, and select CMSIS-DAP Debugger under the debug tab:
-
Check that the "Use Debug Driver" is checked under Utilities tab:
-
Now go into the debugger settings and verify that the nRF51xxx programming algorithm is chosen:
-
Go to tab "debug" and see that the debugger and device is recognized and properly configured:
Loading Softdevice S110 v6 or older:
As the softdevice depends on writing to UICR in these versions, and the flash algorithm does not allow this, we must use the MBED enumerated drive to load the softdevice.
-
Download the S110 softdevice from our website.
-
Extract the content to your desired location.
-
Copy the softdevice .hex file to the MBED enumerated drive X:\ (where X is the MBED drive for your specific computer)
-
Once loaded, please follow the "configuring a project for CMSIS-DAP debugger" section for the s110 project of your desire.
Loading Softdevice S110 v7 or newer:
Since this version of the softdevice does not write into UICR, you have two options:
-
Load it using the same option as for S110 <= v6
-
Load it by creating an empty project, with the softdevice .hex file as the "Name of Executable" in Keil project settings. Copy the softdevice .hex file to the location of the newly created "empty" Keil project.
Troubleshooting:
-
I'm getting this error when trying to program the softdevice:
Error: Flash Download failed - "Cortex-M0"
Try blanking the nRF device. This is done by holding in the RESET button for 5 seconds. The LED "LD3" will start blinking slowly, then faster. Hold the RESET button until the LED is continuously lit. Now the flash on the nRF should be completely erased.
Note: The softdevice is not erase-protected using these method, so do not choose "Erase Full Chip" under "Flash Download" section when developing your application! This behavior will change with future versions of the flash programming algorithm that is supplied with the nRF51 SDK installer.