Getting Started with nRF9160 DK

2019-07-31: Updated tutorial to support nRF Connect SDK (NCS) v1.0.0

2019-05-21: Updated tutorial to cover the changes in the nRF Connect SDK

If you are using your development kit (DK) for the first time, please visit our out-of-box experience here. This will walk you through the set up of getting your DK connected to nRF Cloud running the Asset Tracker application.

This guide is written for those who are looking to get started with the nRF9160 DK which serves as an evaluation platform for the nRF9160 SiP. The nRF9160 is a System-in-Package (SiP) providing a modem capable of LTE-M, NB-IoT, and GPS connectivity while integrating an ARM 64MHz Cortex-M33, 256k RAM, 1M Flash, ARM Cryptocell 310, PMIC, and a variety of peripherals in a compact 10x16x1.0mm package. Also featured on the DK is the multi-protocol, 2.4GHz nRF52840, allowing for LTE gateway applications with BLE, Zigbee, Thread, etc.

An overview of the board can be found in the picture below, marked for reference in the sections to follow.

Contents

Requirements

  • Windows, macOS, Linux PC
  • nRF9160 DK, find a distributor here
  • nanoSIM card supporting LTE-M (iBasis SIM shipped with latest DK)
  • microUSB cable

The below steps were developed on a Windows 10 PC but the steps should be similar for macOS and Linux.

Installing nRF Connect for Desktop, Getting Started Assistant, LTE Link Monitor, & Programmer

  1. Download and install nRF Connect for Desktop by going here. Be sure to select the correct OS. At the time of writing, the latest version on the website was v3.0.0.
                                                                                                                                                                                                       
  2. Open nRF Connect after installation. Check for updates by going to the Settings tab and clicking “Check for updates now.” At the time of writing, the version after updating in the application was v3.0.0.
                                                                                                                                                                                                       
  3. Go to “Add/remove apps” and install the Getting Started Assistant, LTE Link Monitor, and the Programmer apps.
                                                                                                                                                                             

Setting Up nRF Connect SDK Environment

  1. Launch the “Getting Started Assistant” from the “Launch app” tab. At the time of writing, the latest version was v1.0.1.
                                                                                                                                                                                            
  2. Follow all of the steps in the Getting Started Assistant: Install the toolchain, Clone the nRF Connect SDK, Download SEGGER Embedded Studio and Set up a project in SEGGER Embedded Studio. In step number 2 when asked to work with a tagged release or the latest state of development of the nRF Connect SDK, you should check out tag v1.0.0, as this tutorial is written using that. Run the command git checkout v1.0.0However, in step 4, you only need to execute the first part. The part that explains how to set the Zephyr Base and the GNU ARM Embedded Toolchain Directory inside of SEGGER Embedded Studio (SES). How to import a project into SES will be covered in the next sections of this tutorial. Specifically, two examples (Asset Tracker, and AT Client) of setting up a project in SES will be explained in the upcoming sections.

Updating the Modem

Before programming applications using the modem onto the chip, the modem firmware should be updated to the latest version.

  1. In the download section of the nRF9160, download the latest version of nRF9160 LTE-M/NB-IoT/GPS Modem Firmware. At the time of writing, the latest version was 1.0.0.
  2. When the firmware is downloaded to your computer, open the Programmer app inside nRF Connect for Desktop.
  3. Make sure your nRF9160 DK is turned on and click “Select Device” and select the nRF9160 DK which should have 3 COM ports.

  4. After selecting the DK, click "Update modem" in the bottom right corner.

  5. Select and open the modem firmware archive that was downloaded in step 1.

  6. Click "Write" to start the modem firmware update process. DO NOT unplug or turn off the nRF9160 DK during this process.
  7. Once done, you should see a message in the log indicating that the Modem DFU has completed successfully.
  8. (Optional) You can verify the version of the modem firmware by running the AT command AT+CGMR when running an application (such as AT Client) that supports AT commands.

Secure Partition Manager (SPM)

The Secure Partition Manager application provides a reference implementation of a first-stage boot firmware. This firmware is required to set up the nRF9160 DK so that it can run user applications in the non-secure domain. In the newer versions of NCS, when building an application, the SPM will be built automatically, and a merged hex file containing both (application + SPM) of the images will be created. In order to program the SPM in addition to the application onto the board, one should follow step 6, build and flash a multi-image project, in this link. However, this will be shown in the steps down below.

Asset Tracker Application

Remember to set the Zephyr base and the GNU ARM Embedded Toolchain as described in step 4 of the Getting Started assistant, before continuing.

Documentation for this example can be found here.

Programming Asset Tracker to DK

  1. Open SEGGER Embedded Studio which was installed/downloaded in step 3 of the Getting Started Assistant. Go to File → Open nRF Connect SDK Project.
  2. Set CMakeLists.txt, Board Directory, Board Name (be sure to select nrf9160_pca10090ns unless if building the SPM sample), and Build Directory as in the screenshot below.
  3. Power on the DK by plugging the DK to your computer and go to Build → Build Solution. This will build the project.
                                                                                                                                                                                                       
  4. Then, click on Target → Connect J-Link                                                                                                                                                                                                                                                                                 
  5. Next up, choose Target → Download File → Download Intel Hex File...
                                                                                                                                                                                                       
  6. Find the merged hex file, containing both the application and the SPM. It is located in <sourcecode_root>\ncs\nrf\applications\asset_tracker\build_nrf9160_pca10090ns\zephyr. Click Open to start the programming.                                                                                                   

 

Connecting DK to nRF Cloud

  1. Create an nRF Cloud account by going to https://nrfcloud.com/#/ and clicking “Create Account.” 
    1. If you have an unactivated iBasis SIM which you wish to activate using nRF Cloud, do not click “Create Account with DevZone.”
    2. If you already have an account, click “Sign in” in the top right corner.
  2. Once you have logged into your account you will be at the dashboard. Click the “+” icon in the top left corner. This will let you add a device. Choose LTE.
    1. If you have already registered the board on another account on nRF Cloud, you would need to go to that account and remove it before it can be used with the new account.

         

  1. If you need to activate an iBasis SIM card, you can enter the ICCID and PUK. Otherwise, if you have an active SIM card (from iBasis or another carrier), you can click “Already have an active SIM? Skip this step.”
  2. At this point, you should reset the DK by pressing the Reset button. Upon reset, LED3 will be blinking and after it has connected to an LTE tower, both LED3 and LED4 will be blinking indicating that it is ready to pair to an nRF Cloud account. Click “Next” once LED3 and LED4 are blinking.
  3. At this point, you will be presented with a sequence of switch toggles and button presses to pair your DK to your nRF Cloud account. After you have linked the device, LED3 will turn off and LED4 will be on (solid, not blinking).
  4. From your nRF Cloud dashboard, click on Devices on the left side and choose the device that you just added. You will be able to see the GPS coordinates being sent from the DK to the cloud on a map as well as the format of the message that is being sent. At the time of writing, GPS coordinates are simulated and do not reflect the actual location of the DK.
    1. Toggling switch 1 will allow you to change the orientation of the board which is displayed right above the map.
    2. Setting switch 2 to the right (towards the antenna) will allow for the board to send GPS coordinates. Setting switch 2 to the left (away from the antenna) will prevent the board from sending GPS coordinates.

AT Client Application

Remember to set the Zephyr base and the GNU ARM Embedded Toolchain as described in step 4 of the Getting Started assistant, before continuing.

Programming AT Client to DK

In order to build and flash this application, you can the exact same steps as for the Asset Tracker Application, except for when choosing the nRF Connect Options set the options as shown in the image below.

Using LTE Link Monitor

Watch the LTE Link Monitor introduction video here. This gives an introduction to the tool and some of the useful commands. You may find overlap with the steps in the video and the steps below.

  1. Open nRF Connect (installed above). Launch the “LTE Link Monitor” from the “Launch app” tab. At the time of writing, the latest version was v1.0.0. 
                                                                                                                                                                                                       
  2. Power cycle the DK by toggling power switch in the bottom left corner of the board. Click “Select Device” and select the DK which should have 3 COM ports.
                                                                                                                                                                                                       
  3. Reset the DK by pressing the reset button. At this point, messages will appear on the terminal and the AT host sample will start. Notice that in the top right, the UART box is green, while the Modem, UICC, and LTE are red, and PDN is gray. A description of these colors can be found when hovering over the appropriate box. Remember to enable Automatic requests, which is pointed to by a red arrow in the image below.
                                                                                                                                                                                                       
  4. Type the AT command “AT+CFUN?” into the terminal to connect to an LTE network. This should also execute the command “AT+CFUN=1” which will turn on the modem. Type in “AT+CFUN?” once again, and the UART/Modem/UICC/LTE/PDN will be green once an LTE connection is established. A full list of supported AT commands can be found here.                                                                                                                                                   
  5. To view RSSI, scroll down to Settings on the right side, and change the “Periodic signal quality request” away from off (default). The below screenshot is showing the slider set to 1s. Then, go to the “Chart” tab on the top.
                                                                                                                                                                                                       
  6. To get a log of the console output, close the serial port connection, and select “Open logfile.”

Useful Documentation and further reading


  • Check out the nRF Connect SDK Tutorial, which will give you a deeper understanding of the nRF Connect SDK (NCS) and give you a step by step guide on how to build an application from scratch in that framework.
Anonymous