/firmware-nrf-91

Edge Impulse firmware for the nRF9160 DK

Primary LanguageC

Edge Impulse firmware for nRF9160 DK

Edge Impulse enables developers to create the next generation of intelligent device solutions with embedded Machine Learning. This repository contains the Edge Impulse firmware for the Nordic Semiconductor nRF9160 DK development boards, in combination with the ST IKS02A shield. This combination supports all Edge Impulse device features, including ingestion, remote management and inferencing.

Note: Do you just want to use this development board with Edge Impulse? No need to build this firmware. See these instructions for prebuilt images and instructions, or use the data forwarder to capture data from any sensor.

Requirements

Hardware

Software

Or you can build this application with Docker (see below).

Building the device firmware (locally)

  1. Install and configure the nRF Connect SDK:

    1. nRF Connect SDK in a separate folder from this repository (e.g. ~/repos/ncs).

    2. Check out NCS version 1.6.0:

      $ cd ~/repos/ncs/nrf
      $ git checkout v1.6.0
      $ cd ..
      $ west update
      
    3. Set your ZEPHYR_BASE environment variable to ~/repos/ncs/zephyr.

  2. Clone this repository:

    $ git clone https://github.com/edgeimpulse/firmware-nrf91
    
  3. You'll need to flash the board controller once:

    1. Ensure that the PROG/DEBUG switch is in nRF52 postion.

      nRF9160DK PROG/DEBUG switch location

    2. Run:

      $ cd board-controller/
      $ west build -b nrf9160dk_nrf52840@1.0.0
      $ west flash
      
  4. Build and flash the application:

    1. Ensure that the PROG/DEBUG switch is in nRF91 postion.

      nRF9160DK PROG/DEBUG switch location

    2. Build the application (make sure you're in the firmware-nrf91 folder again, not in the board-controller!):

      $ west build -b nrf9160dk_nrf9160ns@1.0.0
      
    3. Flash the application:

      $ west flash
      

Building the device firmware (Docker)

  1. Clone this repository:

    $ git clone https://github.com/edgeimpulse/firmware-nrf91
    
  2. Build the Docker container:

    $ docker build -t edge-impulse-nordic .
    
  3. You'll need to flash the board controller once:

    1. Ensure that the PROG/DEBUG switch is in nRF52 postion.

      nRF9160DK PROG/DEBUG switch location

    2. Run:

      $ docker run --rm -v $PWD:/app edge-impulse-nordic /bin/bash -c "cd board-controller && west build -b nrf9160dk_nrf52840@1.0.0"
      
    3. Copy board-controller/build/zephyr/zephyr.bin to the JLINK mass storage device.

  4. Build and flash the application:

    1. Ensure that the PROG/DEBUG switch is in nRF91 postion.

      nRF9160DK PROG/DEBUG switch location

    2. Build the application:

      $ docker run --rm -v $PWD:/app edge-impulse-nordic /bin/bash -c "west build -b nrf9160dk_nrf9160ns@1.0.0"
      
    3. Copy build/zephyr/zephyr.bin to the JLINK mass storage device.

MQTT demo

To see the output of inference process, make to following steps after deploying ML model:

  1. Insert SIM Card to nRF9160DK and power cycle the board.

  2. Open Serial Port Terminal of the nRF9160DK (use first port eg. ttyACM0 on Linux) on baud rate 115,200.

  3. Connect the board to MQTT server via:

    AT+CONNECT
    

    The connection can take while and as a result you should get the OK response or ERROR if something went wrong.

  4. After successfull connection run the model:

    AT+RUNIMPULSE
    

    or:

    AT+RUNIMPULSECONT
    
  5. Open HiveMQ Online MQTT Client and click Connect

    HiveMQ Online MQTT Client

  6. After connection, click Add New Topic Subscription, in the dialog enter topic ei/demo and click Subscribe

    MQTT Client Subscribe

    MQTT Client topic subscription

  7. After that you should start seeing messages incoming from nRF9160DK

    MQTT Client topic subscription