This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Mesh FDU : bootloader_verify.py failed

Hello,

I'm trying to use the mesh DFU on 2 nRF52840 DK by following the quick start guide and it didn't work.

Using the mesh sdk 2.0.1 I made the below batch file as described on the quick guide 

title Balise firmware update over mesh
Welcome to  nRF DFU test version

echo  Step 3. Generate a DFU file with nrfutil
cd C:\Program Files (x86)\Nordic Semiconductor\nRFgo Studio
nrfutil dfu genpkg --application C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\bin\blinky\blinky_nrf52840_xxAA_s140_6.0.0.hex  --application-version 2 --sd-req 0x00A9 app_dfu_package.zip

echo  Step 4. Generate a HEX version of your device page
cd C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\tools\dfu
device_page_generator.py -d nrf52840_xxAA -sd "s140_6.0.0"

echo  Step 5. Erase all chip memory (including UICR) on all devices
cd C:\Program Files (x86)\Nordic Semiconductor\nRFgo Studio
nrfjprog -s 683954026 --eraseall
nrfjprog -s 683887275 --eraseall

echo  Step 6. Flash the SoftDevice on all devices
nrfjprog -s 683954026 --program C:\Nordic\nRF5_SDK_15.0.0_a53641a\components\softdevice\s140\hex\s140_nrf52_6.0.0_softdevice.hex
nrfjprog -s 683887275 --program C:\Nordic\nRF5_SDK_15.0.0_a53641a\components\softdevice\s140\hex\s140_nrf52_6.0.0_softdevice.hex

echo  Step 7. Flash the serial bootloader on all devices
nrfjprog -s 683954026 --program C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\bin\bootloader\gccarmemb\mesh_bootloader_serial_gccarmemb_nrf52840_xxAA.hex
nrfjprog -s 683887275 --program C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\bin\bootloader\gccarmemb\mesh_bootloader_serial_gccarmemb_nrf52840_xxAA.hex

echo  Step 8. Flash the first application on all devices
nrfjprog -s 683954026 --program C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\examples\dfu\build\dfu_nrf52840_xxAA_s140_6.0.0_Debug\dfu_nrf52840_xxAA_s140_6.0.0.hex
nrfjprog -s 683887275 --program C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\examples\dfu\build\dfu_nrf52840_xxAA_s140_6.0.0_Debug\dfu_nrf52840_xxAA_s140_6.0.0.hex

echo  Step 9. Flash the device page on all devices
nrfjprog -s 683954026 --program C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\tools\dfu\bin\device_page_nrf52840_xxAA_s140_6.0.0.hex
nrfjprog -s 683887275 --program C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\tools\dfu\bin\device_page_nrf52840_xxAA_s140_6.0.0.hex
nrfjprog -s 683954026 --reset 
nrfjprog -s 683887275 --reset

cd C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\tools\dfu
bootloader_verify.py  683954026 COM26
pause 

When trying to verify the bootloader with bootloader_verify.py it get halt on "resetting device..." (see picture below)

I have used device_page_generator.py and bootloader_verify.phy from mesh sdk v2.2.0 since the original scripts have some bugs.

Here the full log of the process

C:\WINDOWS\system32>title Balise firmware update over mesh

C:\WINDOWS\system32>Welcome to  nRF DFU test version
'Welcome' n’est pas reconnu en tant que commande interne
ou externe, un programme exécutable ou un fichier de commandes.

C:\WINDOWS\system32>echo  Step 3. Generate a DFU file with nrfutil
 Step 3. Generate a DFU file with nrfutil

C:\WINDOWS\system32>cd C:\Program Files (x86)\Nordic Semiconductor\nRFgo Studio

C:\Program Files (x86)\Nordic Semiconductor\nRFgo Studio>nrfutil dfu genpkg --application C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\bin\blinky\blinky_nrf52840_xxAA_s140_6.0.0.hex  --application-version 2 --sd-req 0x00A9 app_dfu_package.zip
Zip created at app_dfu_package.zip

C:\Program Files (x86)\Nordic Semiconductor\nRFgo Studio>echo  Step 4. Generate a HEX version of your device page
 Step 4. Generate a HEX version of your device page

C:\Program Files (x86)\Nordic Semiconductor\nRFgo Studio>cd C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\tools\dfu

C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\tools\dfu>device_page_generator.py -d nrf52840_xxAA -sd "s140_6.0.0"
Wrote device page for nrf52840_xxAA with the s140_6.0.0 SoftDevice to bin/device_page_nrf52840_xxAA_s140_6.0.0.hex.

C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\tools\dfu>echo  Step 5. Erase all chip memory (including UICR) on all devices
 Step 5. Erase all chip memory (including UICR) on all devices

C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\tools\dfu>cd C:\Program Files (x86)\Nordic Semiconductor\nRFgo Studio

C:\Program Files (x86)\Nordic Semiconductor\nRFgo Studio>nrfjprog -s 683954026 --eraseall
Erasing user available code and UICR flash areas.
Applying system reset.

C:\Program Files (x86)\Nordic Semiconductor\nRFgo Studio>nrfjprog -s 683887275 --eraseall
Erasing user available code and UICR flash areas.
Applying system reset.

C:\Program Files (x86)\Nordic Semiconductor\nRFgo Studio>echo  Step 6. Flash the SoftDevice on all devices
 Step 6. Flash the SoftDevice on all devices

C:\Program Files (x86)\Nordic Semiconductor\nRFgo Studio>nrfjprog -s 683954026 --program C:\Nordic\nRF5_SDK_15.0.0_a53641a\components\softdevice\s140\hex\s140_nrf52_6.0.0_softdevice.hex
Parsing hex file.
Reading flash area to program to guarantee it is erased.
Checking that the area to write is not protected.
Programming device.

C:\Program Files (x86)\Nordic Semiconductor\nRFgo Studio>nrfjprog -s 683887275 --program C:\Nordic\nRF5_SDK_15.0.0_a53641a\components\softdevice\s140\hex\s140_nrf52_6.0.0_softdevice.hex
Parsing hex file.
Reading flash area to program to guarantee it is erased.
Checking that the area to write is not protected.
Programming device.

C:\Program Files (x86)\Nordic Semiconductor\nRFgo Studio>echo  Step 7. Flash the serial bootloader on all devices
 Step 7. Flash the serial bootloader on all devices

C:\Program Files (x86)\Nordic Semiconductor\nRFgo Studio>nrfjprog -s 683954026 --program C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\bin\bootloader\gccarmemb\mesh_bootloader_serial_gccarmemb_nrf52840_xxAA.hex
Parsing hex file.
Reading flash area to program to guarantee it is erased.
Checking that the area to write is not protected.
Programming device.

C:\Program Files (x86)\Nordic Semiconductor\nRFgo Studio>nrfjprog -s 683887275 --program C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\bin\bootloader\gccarmemb\mesh_bootloader_serial_gccarmemb_nrf52840_xxAA.hex
Parsing hex file.
Reading flash area to program to guarantee it is erased.
Checking that the area to write is not protected.
Programming device.

C:\Program Files (x86)\Nordic Semiconductor\nRFgo Studio>echo  Step 8. Flash the first application on all devices
 Step 8. Flash the first application on all devices

C:\Program Files (x86)\Nordic Semiconductor\nRFgo Studio>nrfjprog -s 683954026 --program C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\examples\dfu\build\dfu_nrf52840_xxAA_s140_6.0.0_Debug\dfu_nrf52840_xxAA_s140_6.0.0.hex
Parsing hex file.
Reading flash area to program to guarantee it is erased.
Checking that the area to write is not protected.
Programming device.

C:\Program Files (x86)\Nordic Semiconductor\nRFgo Studio>nrfjprog -s 683887275 --program C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\examples\dfu\build\dfu_nrf52840_xxAA_s140_6.0.0_Debug\dfu_nrf52840_xxAA_s140_6.0.0.hex
Parsing hex file.
Reading flash area to program to guarantee it is erased.
Checking that the area to write is not protected.
Programming device.

C:\Program Files (x86)\Nordic Semiconductor\nRFgo Studio>echo  Step 9. Flash the device page on all devices
 Step 9. Flash the device page on all devices

C:\Program Files (x86)\Nordic Semiconductor\nRFgo Studio>nrfjprog -s 683954026 --program C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\tools\dfu\bin\device_page_nrf52840_xxAA_s140_6.0.0.hex
Parsing hex file.
Reading flash area to program to guarantee it is erased.
Checking that the area to write is not protected.
Programming device.

C:\Program Files (x86)\Nordic Semiconductor\nRFgo Studio>nrfjprog -s 683887275 --program C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\tools\dfu\bin\device_page_nrf52840_xxAA_s140_6.0.0.hex
Parsing hex file.
Reading flash area to program to guarantee it is erased.
Checking that the area to write is not protected.
Programming device.

C:\Program Files (x86)\Nordic Semiconductor\nRFgo Studio>nrfjprog -s 683954026 --reset
Applying system reset.
Run.

C:\Program Files (x86)\Nordic Semiconductor\nRFgo Studio>nrfjprog -s 683887275 --reset
Applying system reset.
Run.

C:\Program Files (x86)\Nordic Semiconductor\nRFgo Studio>cd C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\tools\dfu

C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\tools\dfu>bootloader_verify.py  683954026 COM26
Reading UICR..                  OK.
Reading Device page..           OK.
Resetting device..

when trying to run the update I get 

C:\Program Files (x86)\Nordic Semiconductor\nRFgo Studio>nrfutil --verbose dfu serial -pkg C:\Python27\Scripts\app_dfu_package.zip -p COM26 -b 115200 -fc
Upgrading target on COM26 with DFU package C:\Python27\Scripts\app_dfu_package.zip. Flow control is enabled.
[------------------------------------] 0%Starting DFU upgrade of type 4, SoftDevice size: 0, bootloader size: 0, application size: 1656
Sending DFU start packet, afterwards we wait for the flash on target to be initialized before continuing.
Timed out waiting for acknowledgement from device.


Failed to upgrade target. Error is: No data received on serial port. Not able to proceed.

Possible causes:
- bootloader, SoftDevice or application on target does not match the requirements in the DFU package.
- baud rate or flow control is not the same as in the target bootloader.
- target is not in DFU mode. If using the SDK examples, press Button 4 and RESET and release both to enter DFU mode.

Please, advice me if I'm missing something here ?

Thank you

/Chaabane

Parents Reply
  • Hi Bjorn,

    the dfu genpkg don't have the options for company id nor application ID in its options ?

    I'm using nrfutil version 0.3.0 that comes with nRFgo Studio as you can see in the screenshot below

    I tried also the laster I could found (3.5.1) but still these options are not available in the nrfutil pkg generate command

    Does the release version in git (exe file) has the mesh dfu fucntionalities  ?

Children
  • You need to download the nrfutil tool shown in the dfu getting started guide. There is a special branch of the file that works for mesh dfu.

  • I have installed nrfutil from the mesh_dfu branch using python setup.py install and I got the following message in the end 

    Using c:\python27\lib\site-packages
    Finished processing dependencies for nrfutil==3.5.1

    so I assume the installation is successful, but when I  check the options in the pkg generate command I don't find company-id and applicaiton-id ?

    running nrfutil from source code "ython nordicsemi/__main__.py" gives the same result

    Any idea where this is coming from ?

  • As you can see from the screenshot below, you should be able to find both the company id & application id:

  • I found the problem, I didn't check the mesh_dfu branch in the first place
    Now I have another error when verifying the booloader

    bootloader_verify.py 683954026 COM26
    Reading UICR.. OK.
    Reading Device page.. OK.
    Resetting device.. ERROR: Invalid start sequence from bootloader: 81020863
    Checkpoints:
    Have you flashed the bootloader with nrfjprog?
    Does your bootloader have serial communication enabled?

    I flashed the bootloader with nrfjprog and when using the bootloader I used have serial comm in it ?

    Below is the script i'm using. for sd 6.0.0 the --sd-seq is 0xA9, right ?

    Would be helpful if you can take a look at it

    title Balise firmware update over mesh
    Welcome to  nRF DFU test version
    
    echo 1. Optional: Generate a signing key file with nrfutil
    cd D:\DEV\GitHub_project\pc-nrfutil\
    nrfutil keys --gen-key D:\Outils\Nordic\DFU\private_key.txt
    
    echo 2. Optional: Add the public key from nrfutil to your device page
    nrfutil keys --show-vk hex D:\Outils\Nordic\DFU\private_key.txt
    
    echo  Step 3. Generate a DFU file with nrfutil
    nrfutil dfu genpkg --application C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\bin\blinky\blinky_nrf52840_xxAA_s140_6.0.0.hex --company-id 0x00000059 --application-id 1 --application-version 2   --sd-req 0x00A9  --mesh app_dfu_package.zip
    
    echo  Step 4. Generate a HEX version of your device page
    cd C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\tools\dfu
    device_page_generator.py -d nrf52840_xxAA -sd "s140_6.0.0"
    
    echo  Step 5. Erase all chip memory (including UICR) on all devices
    cd D:\DEV\GitHub_project\pc-nrfutil\
    nrfjprog -s 683954026 --eraseall
    nrfjprog -s 683887275 --eraseall
    
    echo  Step 6. Flash the SoftDevice on all devices
    nrfjprog -s 683954026 --program C:\Nordic\nRF5_SDK_15.0.0_a53641a\components\softdevice\s140\hex\s140_nrf52_6.0.0_softdevice.hex --chiperase
    nrfjprog -s 683887275 --program C:\Nordic\nRF5_SDK_15.0.0_a53641a\components\softdevice\s140\hex\s140_nrf52_6.0.0_softdevice.hex --chiperase
    
    echo  Step 7. Flash the serial bootloader on all devices
    nrfjprog -s 683954026 --program C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\bin\bootloader\gccarmemb\mesh_bootloader_serial_gccarmemb_nrf52840_xxAA.hex
    nrfjprog -s 683887275 --program C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\bin\bootloader\gccarmemb\mesh_bootloader_serial_gccarmemb_nrf52840_xxAA.hex
    
    echo  Step 8. Flash the first application on all devices
    nrfjprog -s 683954026 --program C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\examples\dfu\build\dfu_nrf52840_xxAA_s140_6.0.0_Debug\dfu_nrf52840_xxAA_s140_6.0.0.hex
    nrfjprog -s 683887275 --program C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\examples\dfu\build\dfu_nrf52840_xxAA_s140_6.0.0_Debug\dfu_nrf52840_xxAA_s140_6.0.0.hex
    
    echo  Step 9. Flash the device page on all devices
    nrfjprog -s 683954026 --program C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\tools\dfu\bin\device_page_nrf52840_xxAA_s140_6.0.0.hex
    nrfjprog -s 683887275 --program C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\tools\dfu\bin\device_page_nrf52840_xxAA_s140_6.0.0.hex
    nrfjprog -s 683954026 --reset 
    nrfjprog -s 683887275 --reset
    
    cd C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\tools\dfu
    bootloader_verify.py  683954026 COM26
    bootloader_verify.py  683887275 COM26
    pause 
    
    echo  Step 10. Transfer the DFU archive over serial with nrfutil
    nrfutil  --verbose dfu serial -pkg C:\Python27\Scripts\app_dfu_package.zip -p COM26 -b 115200 -fc 
    pause

  • Hi,

    You forgot to include the private key in step 3 (i.e. --key-file private_key.txt). It is correct to use 0xA9 for the S140 v 6.0.0 softdevice. If you are unsure in the future, you can program the softdevice on a board that has been erased & open up the nrf programmer app in nrf connect for desktop. Then, when you read the memory, you should be able to see the softdevice code in the log.

    Another option is to use the command: nrfutil pkg generate --help. There, you should see a list of most of the softdevice codes. You will need to use the regular nrfutil, not the mesh nrfutil.

    In step 4, you need to run python before device_page_generator. Otherwise, everything else looks good.

    Kind Regards,

    Bjørn

Related