Friday, September 6, 2024

Secure DFU OTA for nRF52832 solution modules: Creating hex/zip file for implementation – Part 2(Combining/merging built files)

 Following up – Part 1: Bootloader & Application (Click for article link),

We will be focusing on:

in this article.

IC: nRF52832
DK: PCA10040 (for nRF52832)
SDK: 16.0.0
Softdevice: s132_nrf52_7.0.1_softdevice.hex
IDE: Keil C
PC: Win 10


Step 1. Execute the combine batch file in bootloader (nrf52832_bootloader_setting_merge.bat) and generate file of nrf52832_bootloader_secure_combin_settings.hex :

@echo off
title = [ J-Link Tool ] %CD%
set nrfDir=C:\Program Files (x86)\Nordic Semiconductor\nrf5x\bin
set BS= nrf52832_bootloader_secure_settings.hex
set BL= nrf52832_xxaa_s132.hex
set BSBLCombind= nrf52832_bootloader_secure_combin_settings.hex
set path=%nrfDir%;%path%
pause
echo ———–merge image file——————-
mergehex.exe -m %BS% %BL% -o %BSBLCombind%
pause



Step 2. Create a Final.hex file by 3-in-1 batch file(nrf52832_3in1_merge.bat)
※Note : This hex file is created for the production line to pre-load firmware into modules prior to shipment.

@echo off
title = [ J-Link Tool ] %CD%
set nrfDir=C:UsersuserDesktopNordic BLEnRF5_merge toolsnRF52 bin
set SD= s140_nrf52_7.2.0_softdevice.hex
set BLT= nrf52832_bootloader_secure_combin_settings.hex
set APP= nrf52832_xxaa.hex
set SD_BLT=SD_BLT.hex
set Finalfile=Final.hex
set path=%nrfDir%;%path%
pause
echo ———–merge image file——————-
mergehex.exe -m %SD% %BLT% -o %SD_BLT%
pause
mergehex.exe -m %SD_BLT% %APP% -o %Finalfile%
pause



Step 3. Create a DFU(OTA).zip file of nrf52832_xxaa.zip
※Note : This zip file is created for end device DFU(OTA) implementation.

nrfutil pkg generate –hw-version 52 –sd-req 0xCB –application-version 0xFF –application
nrf52832_xxaa.hex –key-file private.pem nrf52832_xxaa.zip

The DFU OTA zip file will be derived.

※Note :
The “0xCB” appeared in the above DOS code(in red font) is the FWID(Firmware ID) for s140_nrf52_7.2.0_softdevice.hex;
FWID can be found from the soft device documents on the Nordic website.




Step 4: Run DFU OTA (On mobile in this example)


4A. Install the nRF Connect APP on mobile, with DFU OTA file: nrf52832_xxaa.zip. (Download link)


4B. Send nrf52832_xxaa.zip via email to mobile device after combination is done on PC, then download it.


4C. Open nRF Connect APP and run connection;


4D. Execute DFU and select “Distribution packet(ZIP)”, thus starting the DFU OTA process.


4E. Start DFU OTA → exit the APP after DFU OTA is completed → restart the mobile device.



Secure DFU OTA for nRF52832 solution modules: Guide to create hex/zip file for implementation
Detailed links of articles:
Part 1: Bootloader & Application (Click for article link)

Part 2: Combining and merging built files



Technical guidelines provided by R&D Manager: Mr. MW Lee
Edited by Sales Manager: Ms. Mandy Chao


Raytac Corporation 勁達國際電子股份有限公司 
Raytac Corporation: A Bluetooth, Wi-Fi, and LoRa Module Maker based on
Nordic nRF54; nRF53: nRF52; nRF51; nRF7002
Semtech Specification: SX1262

Bluetooth Specification: BT5.4 ; BT5.3; BT5.2.
Wi-Fi Specification: Wi-Fi 6
LoRa Specification: LoRaWAN

All products are FCC/IC/CE/Telec/KC/RCM/SRRC/NCC Pre-Certified.
http://www.raytac.com
email: service@raytac.com
Tel: +886-2-3234-0208

No comments:

Post a Comment