Mise à niveau du micrologiciel sans fil sur le Nordic nRF52

We all consider ourself optimists when we write firmware.

In fact, we usually expect things to turn out well. However, even as an optimist, we know that everyone makes mistakes and even with the most perfect code, the requirements or environment may change and require updates in the product. We have had some clients that expressed the desire to not spend time incorporating DFU in their products, citing that the firmware should be written without error for the first release (and in record time!). Here’s the thing: unless you are very deep-pocketed, have a trivial application, a lot of testing time, have a QA group the size of NASA, your firmware will not be perfect the first time.

You will need to incorporate device firmware updates in your application.

It’s possible to do it with the Nordic nRF52. In this post, it will be shown how to take one of the Nordic examples and update the nRF52-DK with it:


Step 1: Flash the IC with the Softdevice.

Open nRFGoStudio and connect your development kit through USB. Toggle the power switch to ON. You should see the nRF52 development kit represented as a segger programmer. Click on it. Click on the Program SoftDevice tab.

Here, you want to program the SoftDevice hex file that comes with the SDK. In the case of the nRF52-DK, the file you need in <nRFx_SDK11_rootdirectory>/components/softdevice/s132/hex/s132_nrf52_2.0.0_softdevice.hex Once it’s selected, click on the Program button. 

In the output log section of nRFgo Studio you should see that the SoftDevice has been programmed successfully.

Step 2: Build and flash the Keil BLE Bootloader example project

In the Nordic SDK, you will find that there is a ready-to-go example project that shows how to perform a DFU through BLE.

It is located at:<nRFx_SDK11_rootdirectory>/examples/dfu/bootloader/pca10040/dual_bank_ble_s132/arm5_no_packs/dfu_dual_bank_ble_s132_pca10040.uvprojx

This example contains the bootloader and DFU code.

Double-click on the example to open it. Click on the build button or press the F7 key to compile.

Note: You may need to install the Keil MDK project packs associated with the Nordic Semiconductor devices. 

Make sure the development kit is plugged in and the power switch is toggled to ON. Click on the LOAD button to flash the firmware. If you have any problems with this step, make sure the latest nrfjprog.exe executable is installed and the right executable is pointed to in your environment system PATH variable.

Step 3: Build the Heart Rate Sensor project and package it.

The next step is to build the target application and package it in such a way that you can flash it through BLE.

Compile the project but don’t flash your board with it. You will want to flash it through BLE from your smartphone. The compilation with produce a .hex file.  The next step is to use the Nordic utilities to package this hex file into a format that contains information about the binary file alongside it. You do this with a program called nrfutils.exe. Open a command window and change your working directory to where the compiled hex file is. In that directory, execute the command: "C:\Program Files (x86)\Nordic Semiconductor\Master Control Panel\\nrf\nrfutil.exe" dfu genpkg --application-version 1 --application nrf52832_xxaa_s132.hex 

A .zip file called should appear in your working directory. If you open the zip you should see it contains three files:

  • manifest.json
  • nrf52832_xxaa_s132.bin
  • nrf52832_xxaa_s132.dat

The manifest contains the information about the binary (application version, crc, etc): { "manifest": { "application": { "bin_file": "nrf52832_xxaa_s132.bin", "dat_file": "nrf52832_xxaa_s132.dat", "init_packet_data": { "application_version": 1, "device_revision": 65535, "device_type": 65535, "firmware_crc16": 9775, "softdevice_req": [ 65534 ] } }, "dfu_version": 0.5 } }

Your .bin file contains the application and the .dat file contains almost the same data as json, but a binary representation of it that is suitable for the bootloader to interpret it.

Step 4: Flash the new firmware using BLE bootloader

There are many ways of uploading a new firmware file to your smartphone. It’s a matter of drag-and-drop with Android, but it’s a whole other ballgame when it comes to iOS. The easiest way I found was to send it to myself by e-mail and open the attachment with the nRF-toolbox app.

Open the attachment with the nRF toolbox app. This will copy the zip file to the app and make it available.  Open the nRF Toolbox app and select DFU. Tap on “Select Device”. You should see the your Dev kit running the bootloader app as “DfuTarg”. Tap on it.  Back to the upload screen, tap “Select File”. Tap on the file you copied from the e-mail earlier.  Tap on “Upload File”   A dialog pop-up indicates that the DFU is complete.


Nordic SDK Documentation

Deux outils gratuits à ne pas manquer!

Motsai s'engage à vous tenir informés des technologies émergentes et de leurs contributions potentielles au processus de développement de vos produits.
Nous avons le plaisir de vous présenter deux ressources axées sur les technologies en vogue et les véritables enjeux du processus de développement de produits. Pour débuter, nous avons élaboré un guide qui couvre tout ce qu'il faut savoir sur les OEM et ODMet, plus important encore, les informations dont vous avez besoin pour prendre les meilleures décisions pour le développement de votre produit.
De plus, nous avons rédigé un e-book sur les micro FPGA, une technologie importante qui mérite d'être étudiée de plus près.
Bonne découverte!

Un guide pour prendre les bonnes décisions !
We are pleased to send you “OEM vs ODM: a guide to navigating the creation of new electronic products”.
Depuis plus d’une décennie, nous cumulons les informations utiles que nous souhaitons maintenant partager avec vous afin que vos projets de développement de produits électroniques soient un véritable succès. TÉLÉCHARGEZ

Les micro FPGA, ou Field Programmable Gate Arrays, sont des puces révolutionnaires que vous pouvez programmer pour effectuer des calculs numériques complexes. Ils deviennent de plus en plus populaires dans le développement de produits en raison de leur polyvalence et de leur puissance.
Notre ebook se penche sur ce sujet, expliquant tout, des principes de base des micro FPGA à leurs applications potentielles dans le développement de produits.
C'est peut-être le changement de cap dont vous avez besoin pour votre prochain projet. TÉLÉCHARGEZ

Comments are closed.