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
  • 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 ?

Children
  • 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

  • Hi Bjorn,

    -I don't use any key in the bootlaoder config file, those lines are just there for the final script

    -I'm using sdk 2.0.1 which I have used to built my application. when I run the device page script from this sdk It doesn't seem to give me the right output file ? see below:

    python 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_nrf52832_xxAA_s132_5.0.0.hex.

    It always outputs a device page for nRF52840 ?

    But when using device_page_generator.py from sdk mesh 2.2.0 I get the right output file (at least the name). I compared both scripts and it seems only text formating and small things hat have changed, so I believe it is safe o use it !

    In step.8  the application I flash in the Soc is built using Segger. It should work aswell or do you think it's better to built it with CMake ?

  • There was an issue with the device page generator python script in mesh sdk v2.0.1. The output name is always based on the nrf52832 device, but the output itself should work fine for the 52840. Yes, you are correct. The device page is safe to use for mesh sdk v2.0.1. It should be fine to build the example using segger instead of cmake.

Related