Nordic Semiconductor and ARM KEIL Build and Flash Toolchain
Nordic Semiconductor and ARM KEIL Build and Flash Toolchain
nRF52840 Running Blinky Program

This Tutorial is a part of nRF52840 IOT Tutorial Series.

nRF52840 ToolChain and nRF5 SDK Setup

In this tutorial, we will be discussing the steps to set up the Software Build Toolchain [ Windows OS ] in ARM KEIL MDK v5 for nRF52840. We will also set up the Toolchain for CMSIS-DAPLink Flashing and Debugging. We will concentrate on the Seeedstudio Grove Mesh Kit nRF52840-MDK IOT Development Kit which has a DAPLink for Flashing and Debugging compared to the Official Development Kit from Nordic Semiconductor which has a J-Link Debugger. I will also Explain the ARM GCC ToolChain setup also in case you don’t want to use the ARM KEIL Microcontroller Development Tools.

I will explain to you how to modify and use the nRF5 SDK from Official Release of Nordic Semiconductor as well as I will explain to you how to use the nRF52840-MDK release from makerdiary especially for the hardware.

Setting Up ARM Keil MDK and µVision® IDE

MDK helps us to create embedded applications for ARM Cortex-M Processor based devices. MDK is a powerful, yet easy to learn and use development system. It consists of MDK-Core and software packs, which can be downloaded and installed based on the requirements of our application. MDK-Core consists of the genuine Keil µVision IDE and debugger with leading support for Cortex-M processor-based microcontroller. MDK includes two ARM C/C++ Compilers with assembler, linker, and highly optimize run-time libraries tailored for optimum code size and performance.

There are different editions of MDK Available :

  • MDK-Lite is code size restricted to 32 KByte and intended for product evaluation, small projects, and the educational market.
  • MDK-Essential supports Cortex-M processor-based microcontrollers up to Cortex-M7 and non-secure programming of Cortex-M23 and M33 targets.
  • MDK-Plus adds middleware libraries for IPv4 networking, USB Device, File System, and Graphics. It supports ARM Cortex-M, selected ARM Cortex-R, ARM7, and ARM9 processor-based microcontrollers. It also includes DS-MDK for programming heterogeneous devices.
  • MDK-Professional contains all features of MDK-Plus. In addition, it supports IPv4/IPv6 dual-stack networking, IoT connectivity, and a USB Host stack. It also offers secure and non-secure programming of Cortex-M23 and M33 targets as well as multicore debugging of heterogeneous devices including the Linux kernel and Streamlines performance analysis.

Out of all these MDK-Lite is free and all other requires a License to Use. I recommend you to use the Lite Version if you are not making very big applications. It is enough for Learning Purpose.

1. Download the latest Installer of MDK-ARM from the Below Link.

 https://www.keil.com/demo/eval/arm.htm

2. Start the Installer and follow the instructions to install MDK-Core on your local computer. The installation also adds the software packs for ARM CMSIS and MDK Middleware.

3. After the MDK-Core installation is complete. Download the Device Family Pack from Below Link.

 https://www.keil.com/dd2/nordicsemiconductor/nrf52840_xxaa/ 

4. Start the Installer and follow the instructions to install the Device Family Pack.

5. Once both the MDK-Core and Device Tree is Installed, start the Keil uVision5 Application. You should see something like below.

6. If you click the Pack Installer Button you will get a window like below. You should be able to find Nordic Semiconductor -> nRF52 Series -> nRF52840_xxAA. You should also be able to find ARM::CMSIS, Keil::ARM_Compiler, Keil::MDK-Middleware. These are important components for the projects to build.

Setting Up the nRF5 SDK from Nordic Semiconductor

nRF5-SDK
nRF5-SDK

Software development kit for the nRF52 series and the nRF51 series SoC. The nRF5 SDK is your first stop for building fully featured, reliable and secure applications with the nRF52 and nRF51 Series. It offers developers a wealth of varied modules and examples right across the spectrum including numerous Bluetooth Low Energy profiles, Device Firmware Upgrade (DFU), GATT serializer and driver support for all peripherals on all nRF5 Series devices. The nRF5 SDK will almost certainly have something for your needs in developing exciting yet robust wireless products.

1. Download the latest ZIP of nRF5 SDK from the Below Link

 https://www.nordicsemi.com/Software-and-Tools/Software/nRF5-SDK 

2. Extract the Zip in a Folder. You should have the subfolders like below.

nRF5 SDK Folder Structure
nRF5 SDK Folder Structure

3. Install the nRF5x_MDK_8_24_1_Keil4_NordicLicense.msi

Verify Installation using Example Blinky Project

1. Download the below Blinky Project for testing nRF52840 Build and Flash ToolChain Setup.

2. Extract the Zip in Below Path. You should have something like the below picture. The build is path-sensitive.

\nRF52\nRF5_SDK_15.3.0_59ac345\examples\peripheral\

3. Open the File Blinky_www.ArnabKumarDas.com.uvprojx , You should be able to see something like below picture.

4. Select the Rebuild Option / Icon from the Top Bar.

5. Once the rebuild is complete you should see no errors and a .hex file will be created.

6. Connect the nRF8540 Hardware to the USB of the PC. It should Power on and a Green LED next to the USB Type-C Connector. Now Press the LOAD Option / Icon or F8 on Keyboard

7. After that, the Flashing will progress and once you see a message similar to the below one press the reset button on the Board and the LED should blink and change colour.

Load "E:\ELECTRONICS\nRF52\nRF5_SDK_15.3.0_59ac345\examples\peripheral\Blinky_www.ArnabKumarDas.com\_build\nrf52840_xxaa.axf" 
Erase Done.
Programming Done.
Verify OK.
Flash Load finished at 23:57:11

8. If nRF52840 Build and Flash ToolChain Setup don’t go around as expected. Please retry or write in comments.


Crazy Engineer

MAKER - ENGINEER - YOUTUBER

2 Comments

Rahul · July 14, 2019 at 1:33 pm

This is really helpful tutorial.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.