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 Thingy:53 development board that includes many different sensors. This firmware supports all Edge Impulse features, including ingestion, remote management, and inferencing. Direct communication with the device is performed over a mobile application, but the user can execute all functions via AT command over a USB interface.
Hardware
- Nordic Semiconductor Thingy:53
- nRF Connect SDK 1.9.1
Software
- nRF Connect SDK 1.9.1
- GNU ARM Embedded Toolchain 9-2019-q4-major.
- nRF Command Line Tools.
- CMake v3.21.3
Or you can build this application with Docker (see below).
-
Clone this repository:
$ git clone https://github.com/edgeimpulse/firmware-nordic-thingy53-internal
-
Build the application:
$ west build -b thingy53_nrf5340_cpuapp
When doing DFU over nRF Connect application,
app_update.bin
file needs to be used (this file is also in thedfu_application.zip
).
-
Clone this repository:
$ git clone https://github.com/edgeimpulse/firmware-nordic-thingy53-internal
-
Build the Docker container:
$ docker build -t edge-impulse-nordic .
-
Build the application:
$ docker run --rm -v $PWD:/app edge-impulse-nordic west build -b thingy53_nrf5340_cpuapp
-
Copy
build/zephyr/zephyr.bin
to theJLINK
mass storage device.
-
Connect the JLink to the Thingy:53; if not previously done, erase the chip with:
nrfjprog --recover
-
Flash the chip, both application core and networking core, with the command:
west flash
-
Connect USB-C to the Thingy:53. Open the enclosure, press the small button (
SW2
) on top of the device and turn the power switch on. -
After the device is on, release the button. The device is now in bootloader mode. For flashing the new firmware, use commands:
mcumgr -t 60 --conntype serial --connstring=/dev/ttyACM0 image list mcumgr -t 60 --conntype serial --connstring=/dev/ttyACM0 image upload app_update.bin
Use nRF Connect for Android and build/zephyr/app_update.bin
. After connecting to the device, click on the DFU icon and select the file. When the DFU process is done, the device will boot with the new image.
- Install mcumgr
- Upload the firmware (adjust the path to
app_update.bin
andhci
interface number if you have a few of them)mcumgr --conntype ble --hci 0 --connstring peer_name='EdgeImpulse' image upload app_update.bin
- Check if the firmware has been uploaded correctly and get the hash of new firmware
The output should be similar to the one below; the new image is in slot 1.
mcumgr --conntype ble --hci 0 --connstring peer_name='EdgeImpulse' image list
Images: image=0 slot=0 version: 0.9.9 bootable: true flags: active confirmed hash: 67f6f87f3f639217140f9e8073cb28f214499d7f646cb774276496108326a7ba image=0 slot=1 version: 0.9.1 bootable: true flags: hash: c218220606d3ecef26dc46ffd7c112e700d08837335516c40ae12f6a86aa7ab2 Split status: N/A (0)
- Test the image and swap the images
mcumgr --conntype ble --hci 0 --connstring peer_name='EdgeImpulse' image test <HASH_OF_THE_IMAGE>
- Reset the device (may take up to 10-20 seconds)
mcumgr --conntype ble --hci 0 --connstring peer_name='EdgeImpulse' reset
MCUboot
and b0n
bootloaders in NCS >1.7.0 have a bug resulting in a network core failed after full OTA update. Therefore (up to NCS 1.9.1) the full firmware has to be made as a mix of components from NCS 1.7.0 and 1.9.1
-
Get NCS 1.7.0 (see instruction above) and build the following example
export ZEPHYR_BASE=~/ncs-1.7.0/zephyr/ cd ~/ncs-1.7.0/nrf/samples/bluetooth/peripheral_uart/ west build -b thingy53_nrf5340_cpuapp
-
Build firmware from this repository (see instruction above)
-
Merge required components (run from this repository level)
${ZEPHYR_BASE}/scripts/mergehex.py -o merged_CPUNET.hex --overlap replace ~/ncs-1.7.0/nrf/samples/bluetooth/peripheral_uart/build/hci_rpmsg/zephyr/b0n_container.hex build/hci_rpmsg/zephyr/signed_by_b0_app.hex ${ZEPHYR_BASE}/scripts/mergehex.py -o merged_CPUAPP.hex --overlap replace ~/ncs-1.7.0/nrf/samples/bluetooth/peripheral_uart/build/mcuboot/zephyr/zephyr.hex build/zephyr/app_signed.hex