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 & 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: sales@raytac.com
Tel: +886-2-3234-0208

Secure DFU OTA for nRF52832 solution modules: Guide to create hex/zip file for implementation – Part 1(Bootloader & Application)

Below are the guidelines to implement Secure DFU OTA by using Raytac’s nRF52832 modules, SDK16.0.0.
It consists of 2 parts:

Part 1: Bootloader & Application


Part 2: Combining and merging built files (Article link)

In this article, we will be focusing on Part 1: Bootloader & Application.



Path: ..\nRF5_SDK_16.0.0_98a08e2\examples\dfu\secure_bootloader\pca10040_s132_ble\arm5_no_packs
Specifically for nRF52832, programmers need to embed ECC(Elliptic Curve Cryptography) into the bootloader.


Step 1. ’micro_ecc_lib_nrf52.lib’ library can be found in the path below, but we need to boot it up first.


Step 2. Unzip ’micro-ecc-master.zip’ to the below path(create a new “micro-ecc” file first).


Step 3. Run ’gcc-arm-none-eabi-7-2018-q2-update-win32.exe’.


Step 4. Make sure the Environment variables in Win10 are set as below. (Follow the steps 1 to 6)


Step 5. Open DOS → run the “make” command under armgcc path → generate’micro_ecc_lib_nrf52.lib’


Step 6. Add ’micro_ecc_lib_nrf52.lib’ into folder: nRF_micro-ecc


Step 7. An error may occur while building bootloader without a public key:
(Shown in red frames in below screenshot)


Step 8. How to generate the public key file in Bootloader?
A. Visit DOS at path: ..\Python27\Scripts
B. Then execute:

nrfutil keys generate private.pem
nrfutil keys display --key pk --format code private.pem --out_file public_key.c


Step 9. Copy the pk[64] code from (public_key.c) into (dfu_public_key.c)
(Shown in red frames in below screenshot)

※Note: Make sure to save the 3 generated files:
private.pem
public_key.c
dfu_public_key.c


Step 10. Generate the bootloader file: nrf52832_xxaa_s132.hex after re-compiling the code files.


Application


Path:
..\nRF5_SDK_16.0.0_98a08e2\examples\ble_peripheral\ble_app_uart\pca10040\s132\arm5_no_packs
Before building Application code , some amendments need to be made regarding DFU-related settings and code inside Application:


Step 1. Add code in definition in C/C++ :
BL_SETTINGS_ACCESS_ONLY NRF_DFU_SVCI_ENABLED NRF_DFU_TRANSPORT_BLE=1
(Total 3 steps definitions need to be set up)


Step 2. Add the 3 paths shown below in C/C++ to make DFU work.


Step 3. Add the .c files inside red frame in (Screenshots 1 & 2)
and add the 2 groups of (nRF_DFU & nRF_SVC)(Screenshot 4) under Project(Screenshot 3)


Step 4. Add code into main.c file in Application (..\examples\ble_peripheral\ble_app_uart\main.c)
(Please refer to: main.c file at: ..\examples\ble_peripheral\ ble_app_buttonless_dfu)


Step 5.
The code of file: sdk_config.h (..\examples\ble_peripheral\ble_app_uart\pca10040\s132\config\sdk_config.h)

inside Application needs to be modified.


Step 6. Adjust the IRAM1 value in Target after implementing DFU service:
Make sure the IRAM1 Value of *p_app_ram_start is modified from default: 0x20002AD8 0xD528 to
0x20002AE8 0xD518, as shown in the red frame in the bottom right corner.
In this case, the program should run/advertise successfully.


Step 7. Create a file of: nrf52832_xxaa.hex after building application code files.



Step 8. Create a bootloader setting file of nrf52832_bootloader_secure_settings.hex via DOS.
nrfutil settings generate –family NRF52 –application nrf52832_xxaa.hex –application-version 3 —
bootloader-version 2 –bl-settings-version 1 nrf52832_bootloader_secure_settings.hex –no-backup

※Stay tuned for Part 2: Combining and merging built files in the next article, scheduled release in next week(04-Sep-2024).


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: sales@raytac.com
Tel: +886-2-3234-0208

Raytac Extents Digi-Key’s Product Listing and Shipping Destination

Digi-Key is the most well known channel for developers to access the sample during project planning and evaluation stage. To provide a speedy, easy sample purchase experience is really a committed promise Raytac persist in. Raytac is glad to announce we have successfully listed most of Raytac products in Digi-Key. Moreover, excepting US, and Asia, to included Europe in the available shipping regions is another remarkable update for this extension. 

Currently, Raytac offer a various of options listed in below, developers may find out the best and convenient channel to access sample purchase.

Digi-Key Amazon Tindie eBay For developers who is not able to find the products, shipping destination or out of stock, please feel free to write to us at service@raytac.com, Raytac’s sales team is always happy to fulfill your demand.

Raytac Corporation 勁達國際電子有限公司
A BT5.2 & BT5.1 & BT5 module maker based on Nordic nRF53 & nRF52 solution 
(nRF5340 & nRF52840 & nRF52833 & nRF52832 & nRF52820 & nRF52811 & nRF52810 & nRF52805)
www.raytac.com email: sales@raytac.com Tel: +886.2.3234.0208

New Distribution Partnership in Greater China Region

Raytac Corporation, a leading supplier of Bluetooth modules, announced a new distribution partnership with Weltrend Semiconductor, Inc. Weltrend has strong FAE team and their extensive footprint of distribution facilities makes them a valuable distribution partner. “We look forward to building our relationship and expanding the Greater China region to serve more customers.”

As a world-renowned supplier of BLE Bluetooth module, Raytac is dedicated to launching various kinds of modules to fulfill all developers’ needs and demands. Raytac’s modules are covered all Nordic solutions, including nRF51822, nRF52810, nRF52811, nRF52820, nRF52832, nRF52833, nRF52840 and nRF5340. Moreover, the modules are fully certified with not only Bluetooth SIG (QDID/DID/BQB), but also regional safety regulation in main areas such as FCC (USA), CE (EU), IC (Canada), TELEC (Japan), KC (Korea), SRRC (China), FCC(Taiwan), RCM (ANZ) , etc.

Raytac aims to build up a value chain to provide customers with a cost-effective and speed-time-to-market solution. Raytac also offers AT Command service allowing customers to adopt easily in IoT field.

WELTREND SEMICONDUCTOR,INC.KAOHSIUNG BRANCH(Taipei Office) Address: 11F-6, No. 736, Chungcheng Rd. Chungho District, New Taipei City., Taiwan http://www.weltrend.com.tw  Tel: +886.2.8226.9297

Raytac Corporation 勁達國際電子有限公司
A BT5.2 & BT5.1 & BT5 module maker based on Nordic nRF53 & nRF52 solution 
(nRF5340 & nRF52840 & nRF52833 & nRF52832 & nRF52820 & nRF52811 & nRF52810 & nRF52805)
www.raytac.com email: sales@raytac.com Tel: +886.2.3234.0208

Office Relocation Notice

Dear Valued Customers,

We are pleased to inform you that our office is going to move to a new location since March 28, 2022. The phone no. and fax remain unchanged.

New Office Address: 8F, No.788-1, Zhongzheng Rd., Zhonghe Dist., New Taipei City, 235601, Taiwan

We apologize for any inconvenience caused and thank you for continued support.

Raytac Corporation 勁達國際電子有限公司
A BT5.2 & BT5.1 & BT5 module maker based on Nordic nRF53 & nRF52 solution 
(nRF5340 & nRF52840 & nRF52833 & nRF52832 & nRF52820 & nRF52811 & nRF52810 & nRF52805)
www.raytac.com email: sales@raytac.com Tel: +886.2.3234.0208

ANT+ Module by Raytac

nRF51422 is the first solution supports both Bluetooth and ANT+, different from pure Bluetooth Low Energy BLE solution, nRF51822 released earlier. The edge cutting technology enable nRF51422 suporting multiprotocol concurrency capable for both Bluetooth Low Energy and ANT+. At the same time Nordic released SDK S310 for nRF51422 which is a combined peripheral BLE and ANT+ protocol stack that supports concurrent operation and all ANT+ features.

When Nordic moved to nRF52, started from nRF52832, the game changed. Even nF52832 still supports ANT+, the technology support such as SDK releasing or developers’ forums, has moved to direct supported by ANT+ Wireless (formerly Dynastream Innovations). Since then, Raytac suggest developers who is interested in ANT+ product still able to select the modules based on core specification and form factor, but access the firmware development support from ANT+ directly. Developers who are interested to know more about ANT+ is encouraged visit ANT+ FAQ support page first for more information about membership, development, resource and certification.

All Nordic nRF52 solutions supports ANT+ feature, developers may refer to below Raytac module map and find what the protocol supports by the symbol stated besides the Nordic solution indication.

Raytac Corporation 勁達國際電子有限公司
A BT5.2 & BT5.1 & BT5 module maker based on Nordic nRF52 & nRF51 solution 
(nRF5340 & nRF52840 & nRF52833 & nRF52832 & nRF52820 & nRF52811 & nRF52810 & nRF52805 & nRF51822)
www.raytac.com. email: cs@raytac.com. Tel: +886.2.3234.0208

Module Design Resource: 2D/3D/Footprint/Reflow/KeepOut Area Design Guide

 With Internet of Things (IoT) technology being the talk of the town for years, Bluetooth obviously has become the most important solutions for short and middle range device connection. 

     Raytac Corporation, a specialized module maker, adapted Nordic solution among various solution providers, developed a rage of modules with different form factors, antenna options and feature capabilities to optimize and simplify the design and development experience. By this comprehensive product line provided, project feasibility would never be the challenge for all developers.

    The pertinent support need out of projects Raytac has been experienced is the accessibility of module design reference, in term of 2D (autocad), 3D (Step / ProE), footprint, reflow, and keep out area suggestion information. To provide a convenient and free to use resource library for developers is seriously been considered. Therefore, Raytac has created a support page in the website, loaded in all the essential design guide information based on all modules. Thus, developers all over the world can just simply click the website and  obtain the immediate design information without taking time in back and forth mail communications. This does significantly save the developing schedule up to 2~3 days at least.

Raytac keep improving to make things easier. Any idea you expect from Raytac, feel free to let us know~

Raytac Website Support Page (Click me)

Raytac Corporation 勁達國際電子有限公司
A BT5.2 & BT5.1 & BT5 module maker based on Nordic nRF52 & nRF51 solution 
(nRF5340 & nRF52840 & nRF52833 & nRF52832 & nRF52820 & nRF52811 & nRF52810 & nRF52805 & nRF51822)
www.raytac.com. email: cs@raytac.com. Tel: +886.2.3234.0208

Raytac Corporation Factory Tour

Many Customers are interested about Raytac’s facility, reliability and capacity. Here, Raytac would like to invite customers having a quick tour and know more about Raytac’s factory.

Raytac’s factory is located in New Taipei City where is located in north of Taiwan. The factory scales 4600 M2 with 180 man power. A completed in house SMT equipment and inspection facility provide a reliable and speedy module production line with over 600,000 pcs monthly capacity.

Raytac Corporation 勁達國際電子有限公司
A BT5.2 & BT5.1 & BT5 module maker based on Nordic nRF52 & nRF51 solution 
(nRF5340 & nRF52840 & nRF52833 & nRF52832 & nRF52820 & nRF52811 & nRF52810 & nRF52805 & nRF51822)
www.raytac.com. email: cs@raytac.com. Tel: +886.2.3234.0208

Some One Like It Cold @ -40°C

Outside the home in the frozen world. Raytac take care!

 Winter is coming and field is chilly. Stay home enjoy the warm is what people is looking for.To ensure users enjoy the joyful time on couch, Raytac conduct a  72 hrs non-stop connection reliability test under -40°which is compliant with industrial standard. The significant result shows there is no any single packet lost over 252,979,200 bytes (244 bytes/Packet).

Raytac Corporation 勁達國際電子有限公司
A BT5.2 & BT5.1 & BT5 module maker based on Nordic nRF52 & nRF51 solution 
(nRF5340 & nRF52840 & nRF52833 & nRF52832 & nRF52820 & nRF52811 & nRF52810 & nRF52805 & nRF51822)
www.raytac.com service@raytac.com Tel: +886.2.3234.0208