The nRF Connect Programmer application now also supports MCUboot! Follow these steps to update through the programmer application or the following guide for the command line alternative.
This guide shows you how to update your Nordic Thingy:91 application FW without having to use an external JLink programmer but instead using the Thingy:91 built-in MCUboot serial recovery mode using the mcumgr command line tool.
mcumgr
Nordic Thingy:91 ships with the asset tracker application running on the nRF9160 SiP and the usb_uart_bridge running on the nRF52840 SoC.
The following steps can also be used to compile and update all the other nRF9160 and nRF52840 compatible applications found in nRF Connect SDK.
go get
go get github.com/apache/mynewt-mcumgr-cli/mcumgr
To get hold of the FW update binaries you could either download the FW package with pre-compiled binaries or compile your own. Pick one of the following methods.
Download and unzip the Thingy:91 FW package found under the download tab on the Thingy:91 product page. Make sure to download v0.2.3 or later.
The MCUboot compatible binary files we will use in the next steps are located here: thingy91fwvXXX\images_dfu\
thingy91fwvXXX\images_dfu\
thingy91_at_client_v0.2.3.bin Firmware for direct modem communication thingy91_ltem_v0.2.2.bin Asset tracker firmware for nRF9160, LTE-M network mode thingy91_nbiot_legacy_pco_v0.2.2.bin Asset tracker firmware for nRF9160, NB-IoT network mode, legacy PCO thingy91_nbiot_v0.2.2.bin Asset tracker firmware for nRF9160, NB-IoT network mode
There are two compile targets of interest for Thingy:91 in nRF Connect SDK; thingy91_nrf9160ns should be used when compiling the application code for the nRF9160 SiP and thingy91_nrf52840 should be used when compiling the code for the on-board nRF52840 SoC.
thingy91_nrf9160ns
thingy91_nrf52840
The default applications on the Thingy:91 are asset_tracker for the nRF9160, and the connectivity_bridge for the nRF52840. These two applications can be built for the Thingy:91 without modifications by following the steps below. If you want to use a different application, you must also follow the steps in How to program any project to the Thingy:91 with DFU to make the application compatible with the bootloader on the Thingy:91.
asset_tracker
connectivity_bridge
Go into the desired application folder. In this case, compiling the asset tracker application for the thingy91_nrf9160ns target.
cd ncs\nrf\applications\asset_tracker
Make sure you have the latest version of NCS master by pulling the nrf repository by running git pull, then run west update to get the rest of the dependencies.
git pull
west update
Compile the code using west:
west build -b thingy91_nrf9160ns
The MCUboot compatible binary file we will use in the next steps is located here: build\zephyr\app_update.bin
build\zephyr\app_update.bin
Before trying to update your Thingy:91 FW make sure it's connected to your computer using USB.
mcumgr image upload
In the below commands change <image> to the desired binary file from the above “Getting the FW” steps and change <serial port> to the serial port the Thingy:91 is assigned when connected to your system. Format for <serial port> should be e.g. COM1 for Windows and something like /dev/ttyACM0 for Linux based systems.
<image>
<serial port>
COM1
/dev/ttyACM0
mcumgr --conntype=serial --connstring=<serial port> image upload <image>
mcumgr --conntype=serial --connstring=<serial port> reset
When installing mcumgr, it's a good idea to use the -v verbose. Otherwise, you might get the impression that go has gone off into the weeds.
go get -v github.com/apache/mynewt-mcumgr-cli/mcumgr
While running
west build -b nrf9160_pca20035ns
I am getting : ERROR: Build directory C:\Users\parva\ncs\v1.3.1\nrf\applications\asset_tracker\build targets board thingy91_nrf9160ns, but board nrf9160_pca20035ns was specified. (Clean the directory, use --pristine, or use --build-dir to specify a different one.)FATAL ERROR: refusing to proceed without --force due to the above errorso, I changed the board name to thingy91_nrf9160ns and then I was getting this error:FATAL ERROR: command exited with status 1: 'C:\Program Files\CMake\bin\cmake.EXE' '-BC:\Users\parva\ncs\v1.3.1\nrf\applications\asset_tracker\build' '-SC:\Users\parva\ncs\v1.3.1\nrf\applications\asset_tracker' -GNinjaWhat to do about it?
Does the same command apply to modem firmware dfu?
My target is running mfw_nrf9160_1.2.0 and I tried providing mfw_nrf9160_update_from_1.2.0_to_1.2.0-FOTA-TEST.bin as the <image>. It always fail with error 3.
Make sure that CONFIG_BOOTLOADER_MCUBOOT=y is added to the project configuration file then compile and it should appear an app_update.bin file in the current build folder under zephyr.
fabocode
On master branch or newer tag versions of NCS, "app_update.bin" will be generated instead of "update.bin".