This post introduces the tools and environment for getting started with the NRF51822 based development. The chipset we used has ARM Cortex M0 in it, with highly configurable peripherals such that the UART,SPI,I2C peripherals can be connected to any Port pins!!
Tools used
- Segger Embedded Studio
- nRF51 SDK version 5.2.0
- nRF51 Softdevice version 6.0.0
- JLink debugger/programmer
Using Segger embedded studio with softdevice v6.0 + nRF SDK 5.2.0
Download the file from nrf51_sdk_v5_2_0_39364.zip from below link (https://developer.nordicsemi.com/nRF5_SDK/nRF51_SDK_v5.x.x/
Extract to C:/ nordic_semi/
Download the the softdevice hex file v6.0 from the below link
(https://www.nordicsemi.com/eng/nordic/Products/nRF51822/S110-SD-v6/26379)
Programming softdevice core
There are two ways to program the Softcore hex file.
1) Use nRFgo Studio to program the softdevice.
Press Erase all.
Browse the s110_nrf51822_6.0.0_softdevice.hex file and put 80 in the softdevice size.
Press Program button
Done
nRFgo doesnot work in Linux.
2) Programming Softdevice using nrfprog commandline utility
For Linux users as usual commandline comes to the rescue. And is more powerful and handy at the same time..
Download the programming utility from
https://www.nordicsemi.com/eng/nordic/Products/nRF51822/nRF5x-Command-Line-Tools-Linux64/51386
- Erase the chip using
./nrfjprog -f NRF51
- Program the softdevice core
./nrfjprog -f NRF51 --program <pathto file>/s110_nrf51_8.0.0_softdevice.hex
Using Segger Embedded Studio to run the SDK samples
Use the segger embedded studio to import the sdk project from C:\nordic_semi\ nrf51_sdk_v5_2_0_39364\examples using File -> Import Project -> Keil project.
Note:
Open the projects from the folder PCA10001+S110. This will ensure that the project suits nRF51422 chip which is similar to our intended nRF51822. S110 folder specifies that the code is compatible with the softdevice S110 which we program in the above section.
Important: Don’t press program button straightaway. We need to change the Device and Linker script first.
Go to project build options(not solution build options), by right clicking on the project name(not solution name) and select “Edit Options”.
Select Debugger Tab.
Change the Target Connection to JLink
Target device to nRF51822_xxAA
Select Build Tab
Change the Memory Segment to
FLASH RX 0x00014000 0x0002C000
SRAM RWX 0x20002000 0x00002000
Try compiling the code.
Note: If there is any error like "core_cm0.h file not found" - then copy all files from C:\nordic_semi\nrf51_sdk_v5_2_0_39364\components\toolchain\gcc\ to C:\nordic_semi\nrf51_sdk_v5_2_0_39364\components\toolchain\
It is important to erase the device using nRFgo or nRFcommand tool, if you want to run the examples without using softcore.
Happy Hacking!!