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
  • Hi Chaabane,

    Why did you not include the company id or application id in the nrfutil command in step 3? That might be the reason that the dfu is not working.

    Kind Regards,

    Bjørn

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

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

Reply Children
  • Hi Bjorn,

    I am not able to make it work no matter what I do.

    I have removed all the utility related to the DFU setup (python, sdk 15, mesh sdk...et) and started from scratch.

    I attached here the script I'm using for the process and would really appreciate it if you can run it on your side to see if it works for you. I made it less path dependent but you'll have to change a path or 2 at max.

    I'm using nRF sdk 15.0.0 mesh sdk 2.0.1 with \tools folder from sdk 2.2.0 since the original one has file naming issues.

    Now I'm getting no data from the serial port when reseting the board ( with reset command or power cycle).

    when running bootloader_verify.py script it gets stuck at "ressetting device" in reading the serial port o be precise.

    With the same setup I run the uart example in the nRF sdk and I'm able to see 'UART example started." message on the terminal so the uart connection to my pc is working.

    Here is the script:

    cd C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src
    
    echo 3. Generate a DFU file with nrfutil
    nrfutil dfu genpkg --application bin/blinky/blinky_nrf52840_xxAA_s140_6.0.0.hex --company-id 0x00000059  --application-id 1 --application-version 2  --sd-req 0x00A9 --mesh dfu_test.zip
    
    
    echo 4. Generate a HEX version of your device page
    cd C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\tools\dfu
    python device_page_generator.py -d nrf52840_xxAA -sd "s140_6.0.0"
    
    
    cd C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src
    echo 5. Erase all chip memory (including UICR) on all devices
    nrfjprog -s 683954026 --eraseall
    nrfjprog -s 683887275 --eraseall
    
    
    echo 6. Flash the SoftDevice on all devices
    nrfjprog -s 683954026 --program bin\softdevice\s140_nrf52_6.0.0_softdevice.hex --chiperase
    nrfjprog -s 683887275 --program bin\softdevice\s140_nrf52_6.0.0_softdevice.hex --chiperase
    
    
    echo 7. Flash the serial bootloader on all devices
    nrfjprog -s 683954026 --program bin\bootloader\gccarmemb\mesh_bootloader_serial_gccarmemb_nrf52840_xxAA.hex
    nrfjprog -s 683887275 --program bin\bootloader\gccarmemb\mesh_bootloader_serial_gccarmemb_nrf52840_xxAA.hex
    
    
    echo 8. Flash the first application on all devices
    nrfjprog -s 683954026 --program examples\dfu\build\dfu_nrf52840_xxAA_s140_6.0.0_Debug\dfu_nrf52840_xxAA_s140_6.0.0.hex
    nrfjprog -s 683887275 --program examples\dfu\build\dfu_nrf52840_xxAA_s140_6.0.0_Debug\dfu_nrf52840_xxAA_s140_6.0.0.hex
    
    echo 9. Flash the device page on all devices
    ::nrfjprog -s 683954026 --program tools/dfu/bin/device_page_nrf52832_xxAA_s132_5.0.0.hex
    ::nrfjprog -s 683887275 --program tools/dfu/bin/device_page_nrf52832_xxAA_s132_5.0.0.hex
    nrfjprog -s 683954026 --program tools/dfu/bin/device_page_nrf52840_xxAA_s140_6.0.0.hex
    nrfjprog -s 683887275 --program tools/dfu/bin/device_page_nrf52840_xxAA_s140_6.0.0.hex
    nrfjprog -s 683954026 --reset
    nrfjprog -s 683887275 --reset
    
    python tools\dfu\bootloader_verify.py 683954026 COM26
    pause
    

    In the case the script worked for you. Can you please send me the hex files you used/generated.

    Chaabane

  • Hi Bjorn,

    did you get a chance to try my script out ?

    I ignored the bootloader verification and ran the dfu serial command 

    nrfutil  --verbose dfu serial -pkg dfu_test.zip -p COM26 -b 115200
    Upgrading target on COM26 with DFU package C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\dfu_test.zip. Flow control is disabled.
    Starting DFU upgrade of type 4, SoftDevice size: 0, bootloader size: 0, application size: 1912
    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.

    Can you please answer the following questions:

    1- why i says softdevice size and bootloader size is 0 ! is that normal ?

    2- Can you confirme that Tx and Rx pins used in the bootloader are the P0.06 and P0.08  ? 

    3-When flashing the softdevice, bootloader, application and device page. does the bootloader blocks in waiting mode or will jump the application (dfu example in my case)?

    Thank you in advance

    /Chaabane

  • Hi Chaabane,

    Sorry for the delayed response. Why did you remove the private_key.txt? You will need to use this in step 3 when you create the dfu zip file.

    I am not sure you can just use the tools folder from mesh sdk v2.2.0 in v2.0.1 & expect it to work. This might be the case, but I would rather use the tools from v2.0.1 if I were you. The tools from v2.0.1 should work fine apart from the naming bug.

    Also, you did not include -fc --mesh in the last nrfutil dfu serial command.

    1) That is not normal behavior.

    2) You should not need to make any changes to the Tx & Rx pins in the bootloader.

    3) Unsure

    Kind Regards,

    Bjørn

  • I found the problem. I had a the hard flow control wrong on my setup.

    The simplest thing that waste time Slight smile

Related