IC: nRF52832
DK: PCA10040(對應到nRF52832)
SDK: 16.0.0
SD: s132_nrf52_7.0.1_softdevice.hex
IDE: Keil C
PC: Win 10
接續上一篇 - Part 1: Bootloader和Application(文章連結請按此), 本篇會針對
Part 2: 合併檔案並執行DFU OTA
的主題做介紹。
Part 2: 合併檔案並執行DFU OTA
步驟1:執行bootloader的combin批次檔
nrf52832_bootloader_setting_merge.bat批次檔如下,
執行後會得到nrf52832_bootloader_secure_combin_settings.hex檔案。
@echo off
title = [ J-Link Tool ] %CD%
set nrfDir=C:Program Files (x86)Nordic Semiconductornrf5xbin
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

步驟2:從三併一批次檔(nrf52832_3in1_merge.bat批次檔)產生Final.hex
※註:Final.hex檔的主要用途為:客製化燒錄 使用。
nrf52832_3in1_merge.bat批次檔如下,執行後會得到Final.hex檔案。
@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
步驟3:產生DFU(OTA) .zip的壓縮檔:nrf52832_xxaa.zip,供終端設備跑DFU(OTA)。
A. 到DOS的下列路徑:..Python27Scripts
B. 執行以下指令:
nrfutil pkg generate --hw-version 52 --sd-req 0xCB --application-version 0xFF --application nrf52832_xxaa.hex --key-file private.pem nrf52832_xxaa.zip
產生的 nrf52832_xxaa.zip就是用於DFU OTA 的壓縮檔。
註: FWID 0xCB for s132_nrf52_7.0.1_softdevice.hex 使用;可以從Nordic網站上的SoftDevice文件中得到。
步驟4:透過nRF Connect手機APP執行 DFU(OTA)
4-1 先在手機上安裝 nRF Connect for mobile APP (下載連結請按此)
4-2 DFU(OTA) .zip 檔案名稱為:nrf52832_xxaa.zip;
可以先從電腦上透過電子郵件傳送nrf52832_xxaa.zip的zip檔,再使用手機收信並下載。

4-3 開啟 nRF Connect for mobile APP並連接裝置 (connect device)。

4-4 點擊 ”DFU” 並選擇剛剛下載的nrf52832_xxaa.zip壓縮檔。




4-5 開始跑DFU(OTA) → 等待DFU(OTA) 更新完成 → 關閉應用程式 → 重啟裝置 → 完成DFU(OTA)。




本系列: 如何產生執行DFU(OTA)所需的 hex/zip 檔 – 步驟說明#2 - 合併檔案並執行DFU OTA
Part 1: Bootloader和Application (文章連結)
Part 2: 合併檔案並執行DFU OTA
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
沒有留言:
張貼留言