To start developing your own application, you should first test that you set up your toolchain correctly. To do so, compile, program, and run a very simple example that does not use a SoftDevice, for example the Blinky Example.
Make sure that you have all required tools installed and that the board is connected to your computer. For nRF52 Development Kits, see Setting up the development kit. For nRF51 Development Kits, follow the steps in section 3 (Getting started) in the nRF51 Development Kit User Guide.
Before you program an example, erase the contents of the board.
If no SoftDevice has been installed on the board, simply open Keil and select Flash > Erase.
If a SoftDevice has been installed on the board or if you are not sure, use nRFgo Studio to make sure that you erase the whole board. Select your device in the Device Manager pane. Then click the Erase All button. If you prefer to use a command line tool instead, use nrfjprog (which is installed with nRFgo Studio).
To run the example:
...\examples\peripheral\blinky
....\pca10040
....\blank
....\arm5_no_packs
.