I need to implement using OTA to upgrade the thread.I followed Thread Tutorial: Practical guide for device upgrade OTA provided to complete the upgrade process,but it didn't success.
I have 3 nRF52840 Development Kits.
1 DK will run a Client + Bootloader.
1 DK will run a Server.
1 DK will be used as a packet sniffer.
Here are my steps.
Step 1: nRF Sniffer with Wireshark setup.
I followed the instructions and did.
Step 2: Setup for a bootloader with logging.
I don't need to log, so I didn't do this step.
Step 3: Setup for new Client firmware
I followed the instructions and did.
Step 4: Generating keys
I followed the instructions and did.
nrfutil keys generate priv.pem
nrfutil keys display --key pk --format code priv.pem --out_file dfu_public_key.c
then replace dfu_public_key.c with the <InstallFolder>\examples\dfu\dfu_public_key.c
Step 5: Command line script
I only changed the snr in the script, here is the result of the run.
make -j -C bootloader\pca10056\blank\armgcc make -j -C Client\pca10056\blank\armgcc make -j -C Client_test\pca10056\blank\armgcc nrfutil pkg generate --hw-version 52 --sd-req 0x00 --application-version 2 --application Client_test\pca10056\blank\armgcc\_build\nrf52840_xxaa.hex --key-file priv.pem app_dfu_package.zip nrfutil settings generate --family NRF52840 --application Client\pca10056\blank\armgcc\_build\nrf52840_xxaa.hex --application-version 1 --bootloader-version 1 --bl-settings-version 1 settings.hex mergehex -m Client\pca10056\blank\armgcc\_build\nrf52840_xxaa.hex settings.hex -o dfu_Client.hex REM Programming section REM Board 1 nrfjprog -e --snr 683879203 nrfjprog -f nrf52 --program mbr_nrf52_2.4.1_mbr.hex --chiperase --snr 683879203 nrfjprog -f nrf52 --program bootloader\pca10056\blank\armgcc\_build\nrf52840_xxaa_mbr.hex --snr 683879203 nrfjprog -f nrf52 --program dfu_Client.hex --sectorerase --snr 683879203 nrfjprog -r --snr 683879203 PAUSE
Step 6: Test procedure
1. use nrfutil to flash the Server firmware to the Server DK. From the dfu folder (<InstallFolder>\examples\thread\dfu\) open a command prompt window and run the following command:
nrfutil dfu thread -f -pkg app_dfu_package.zip -p COM6 --channel 11 --panid 43981

2. Power up the client,and run script create in Step 5.
D:\widic\nRF5_SDK_for_Thread_and_Zigbee_v4.1.0_32ce5f8\examples\thread\dfu>make -j -C bootloader\pca10056\blank\armgcc
make: Entering directory 'D:/widic/nRF5_SDK_for_Thread_and_Zigbee_v4.1.0_32ce5f8/examples/thread/dfu/bootloader/pca10056/blank/armgcc'
make: *** No rule to make target 'c\:\arm-gcc\lib\gcc\arm-none-eabi\10.2.1\include\stdint.h', needed by '_build/nrf52840_xxaa_mbr/bsp.c.o'. Stop.
make: Leaving directory 'D:/widic/nRF5_SDK_for_Thread_and_Zigbee_v4.1.0_32ce5f8/examples/thread/dfu/bootloader/pca10056/blank/armgcc'
D:\widic\nRF5_SDK_for_Thread_and_Zigbee_v4.1.0_32ce5f8\examples\thread\dfu>make -j -C Client\pca10056\blank\armgcc
make: Entering directory 'D:/widic/nRF5_SDK_for_Thread_and_Zigbee_v4.1.0_32ce5f8/examples/thread/dfu/Client/pca10056/blank/armgcc'
make: *** No rule to make target 'c\:\arm-gcc\lib\gcc\arm-none-eabi\10.2.1\include\stdint.h', needed by '_build/nrf52840_xxaa/bsp.c.o'. Stop.
make: Leaving directory 'D:/widic/nRF5_SDK_for_Thread_and_Zigbee_v4.1.0_32ce5f8/examples/thread/dfu/Client/pca10056/blank/armgcc'
D:\widic\nRF5_SDK_for_Thread_and_Zigbee_v4.1.0_32ce5f8\examples\thread\dfu>make -j -C Client_test\pca10056\blank\armgcc
make: Entering directory 'D:/widic/nRF5_SDK_for_Thread_and_Zigbee_v4.1.0_32ce5f8/examples/thread/dfu/Client_test/pca10056/blank/armgcc'
make: *** No rule to make target 'c\:\arm-gcc\lib\gcc\arm-none-eabi\10.2.1\include\stdint.h', needed by '_build/nrf52840_xxaa/bsp.c.o'. Stop.
make: Leaving directory 'D:/widic/nRF5_SDK_for_Thread_and_Zigbee_v4.1.0_32ce5f8/examples/thread/dfu/Client_test/pca10056/blank/armgcc'
D:\widic\nRF5_SDK_for_Thread_and_Zigbee_v4.1.0_32ce5f8\examples\thread\dfu>nrfutil pkg generate --hw-version 52 --sd-req 0x00 --application-version 2 --application Client_test\pca10056\blank\armgcc\_build\nrf52840_xxaa.hex --key-file priv.pem app_dfu_package.zip
Zip created at app_dfu_package.zip
D:\widic\nRF5_SDK_for_Thread_and_Zigbee_v4.1.0_32ce5f8\examples\thread\dfu>nrfutil settings generate --family NRF52840 --application Client\pca10056\blank\armgcc\_build\nrf52840_xxaa.hex --application-version 1 --bootloader-version 1 --bl-settings-version 1 settings.hex
Note: Generating a DFU settings page with backup page included.
This is only required for bootloaders from nRF5 SDK 15.1 and newer.
If you want to skip backup page generation, use --no-backup option.
Generated Bootloader DFU settings .hex file and stored it in: settings.hex
Bootloader DFU Settings:
* File: settings.hex
* Family: NRF52840
* Start Address: 0x000FF000
* CRC: 0xC4963B7D
* Settings Version: 0x00000001 (1)
* App Version: 0x00000001 (1)
* Bootloader Version: 0x00000001 (1)
* Bank Layout: 0x00000000
* Current Bank: 0x00000000
* Application Size: 0x000642E0 (410336 bytes)
* Application CRC: 0x4F829DC2
* Bank0 Bank Code: 0x00000001
* Softdevice Size: 0x00000000 (0 bytes)
* Boot Validation CRC: 0x00000000
* SD Boot Validation Type: 0x00000000 (0)
* App Boot Validation Type: 0x00000000 (0)
D:\widic\nRF5_SDK_for_Thread_and_Zigbee_v4.1.0_32ce5f8\examples\thread\dfu>mergehex -m Client\pca10056\blank\armgcc\_build\nrf52840_xxaa.hex settings.hex -o dfu_Client.hex
Parsing input files.
Merging file "nrf52840_xxaa.hex" into output.
Merging file "settings.hex" into output.
Storing merged file.
D:\widic\nRF5_SDK_for_Thread_and_Zigbee_v4.1.0_32ce5f8\examples\thread\dfu>REM Programming section
D:\widic\nRF5_SDK_for_Thread_and_Zigbee_v4.1.0_32ce5f8\examples\thread\dfu>REM Board 1
D:\widic\nRF5_SDK_for_Thread_and_Zigbee_v4.1.0_32ce5f8\examples\thread\dfu>nrfjprog -e --snr 683879203
Erasing user available code and UICR flash areas.
Applying system reset.
D:\widic\nRF5_SDK_for_Thread_and_Zigbee_v4.1.0_32ce5f8\examples\thread\dfu>nrfjprog -f nrf52 --program mbr_nrf52_2.4.1_mbr.hex --chiperase --snr 683879203
Parsing image file.
Erasing user available code and UICR flash areas.
Applying system reset.
Checking that the area to write is not protected.
Programming device.
D:\widic\nRF5_SDK_for_Thread_and_Zigbee_v4.1.0_32ce5f8\examples\thread\dfu>nrfjprog -f nrf52 --program bootloader\pca10056\blank\armgcc\_build\nrf52840_xxaa_mbr.hex --snr 683879203
Parsing image file.
Reading flash area to program to guarantee it is erased.
Checking that the area to write is not protected.
Programming device.
D:\widic\nRF5_SDK_for_Thread_and_Zigbee_v4.1.0_32ce5f8\examples\thread\dfu>nrfjprog -f nrf52 --program dfu_Client.hex --sectorerase --snr 683879203
Parsing image file.
Erasing page at address 0x1000.
Erasing page at address 0x2000.
Erasing page at address 0x3000.
Erasing page at address 0x4000.
Erasing page at address 0x5000.
Erasing page at address 0x6000.
Erasing page at address 0x7000.
Erasing page at address 0x8000.
Erasing page at address 0x9000.
Erasing page at address 0xA000.
Erasing page at address 0xB000.
Erasing page at address 0xC000.
Erasing page at address 0xD000.
Erasing page at address 0xE000.
Erasing page at address 0xF000.
Erasing page at address 0x10000.
Erasing page at address 0x11000.
Erasing page at address 0x12000.
Erasing page at address 0x13000.
Erasing page at address 0x14000.
Erasing page at address 0x15000.
Erasing page at address 0x16000.
Erasing page at address 0x17000.
Erasing page at address 0x18000.
Erasing page at address 0x19000.
Erasing page at address 0x1A000.
Erasing page at address 0x1B000.
Erasing page at address 0x1C000.
Erasing page at address 0x1D000.
Erasing page at address 0x1E000.
Erasing page at address 0x1F000.
Erasing page at address 0x20000.
Erasing page at address 0x21000.
Erasing page at address 0x22000.
Erasing page at address 0x23000.
Erasing page at address 0x24000.
Erasing page at address 0x25000.
Erasing page at address 0x26000.
Erasing page at address 0x27000.
Erasing page at address 0x28000.
Erasing page at address 0x29000.
Erasing page at address 0x2A000.
Erasing page at address 0x2B000.
Erasing page at address 0x2C000.
Erasing page at address 0x2D000.
Erasing page at address 0x2E000.
Erasing page at address 0x2F000.
Erasing page at address 0x30000.
Erasing page at address 0x31000.
Erasing page at address 0x32000.
Erasing page at address 0x33000.
Erasing page at address 0x34000.
Erasing page at address 0x35000.
Erasing page at address 0x36000.
Erasing page at address 0x37000.
Erasing page at address 0x38000.
Erasing page at address 0x39000.
Erasing page at address 0x3A000.
Erasing page at address 0x3B000.
Erasing page at address 0x3C000.
Erasing page at address 0x3D000.
Erasing page at address 0x3E000.
Erasing page at address 0x3F000.
Erasing page at address 0x40000.
Erasing page at address 0x41000.
Erasing page at address 0x42000.
Erasing page at address 0x43000.
Erasing page at address 0x44000.
Erasing page at address 0x45000.
Erasing page at address 0x46000.
Erasing page at address 0x47000.
Erasing page at address 0x48000.
Erasing page at address 0x49000.
Erasing page at address 0x4A000.
Erasing page at address 0x4B000.
Erasing page at address 0x4C000.
Erasing page at address 0x4D000.
Erasing page at address 0x4E000.
Erasing page at address 0x4F000.
Erasing page at address 0x50000.
Erasing page at address 0x51000.
Erasing page at address 0x52000.
Erasing page at address 0x53000.
Erasing page at address 0x54000.
Erasing page at address 0x55000.
Erasing page at address 0x56000.
Erasing page at address 0x57000.
Erasing page at address 0x58000.
Erasing page at address 0x59000.
Erasing page at address 0x5A000.
Erasing page at address 0x5B000.
Erasing page at address 0x5C000.
Erasing page at address 0x5D000.
Erasing page at address 0x5E000.
Erasing page at address 0x5F000.
Erasing page at address 0x60000.
Erasing page at address 0x61000.
Erasing page at address 0x62000.
Erasing page at address 0x63000.
Erasing page at address 0x64000.
Erasing page at address 0x65000.
Erasing page at address 0xFE000.
Erasing page at address 0xFF000.
Applying system reset.
Checking that the area to write is not protected.
Programming device.
D:\widic\nRF5_SDK_for_Thread_and_Zigbee_v4.1.0_32ce5f8\examples\thread\dfu>nrfjprog -r --snr 683879203
Applying system reset.
Run.
Then the server never had the client upgrade prompt.I have attached the package that my sniffer caught, please help to see why it is not upgraded.