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

Problem with DFU mesh generate hex version of device page

Hi,

I'm following DFU quick start guide and I'm using mesh SDK v2.0.1, I have a problem in step 4 wheere I need to generate a hex version of device page, I did this : 

dfu$ py device_page_generator.py -d nrf52832_xxAA -sd "s132_6.0.0" and this is the result:

Wrote device page for nrf53832_xxAA with the s132_6.0.0 SoftDevice to bin/device_page_nrf52832_xxAA_s132_5.0.0.hex instead of s132 version 6 

here is the bin directory:

I don't know why it doesn't generate device page with s132 v6.0.0, help please

Thanks in advance,

  • The problem above is solved by following this case but now I'm facing another issue in step 10, It shows : Failed to upgrade target. Error is: Failed to establish connection. I have two nRF52832 Devkits (host and target), from step 5 to 9 I flashed all firmwares on both devices, in step 10 i just defined COM port for one of the devices to specify it as host device, I don't know if that's enough to say which device is the host or which is the target or there is another step that I'm missing, help please

    Here is my cmd script : I used mesh SDK v2.0.0 provided in the case mentioned above 

    C:\WINDOWS\system32>cd C:\Users\Mariem\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src>cd in
    Le chemin d’accès spécifié est introuvable.
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src>cd bin
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src\bin>cd blinky
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src\bin\blinky>nrfutil keys --gen-key private_key.txt
    Generated key at: private_key.txt
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src\bin\blinky>nrfutil keys --show-vk hex private_key.txt
    Verification key Qx: 4470d73a4edb6c05b80f24b16e5c2882cbd27fc9c1c73e8dade98bb74fdd68c2
    Verification key Qy: 2db570702e78fdb569ef3e941092a6672dc86ed541f595054b8877ebe89ed66b
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src\bin\blinky>nrfutil dfu genpkg --application blinky_nrf52832_xxAA_s132_5.0.0.hex --company-id 0x00000059 --application-id 1 --application-version 3 --key-file private_key.txt --sd-req 0x009D --mesh dfu_test.zip
    Key file was given, setting DFU version to 0.8
    Zip created at dfu_test.zip
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src\bin\blinky>cd ..
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src\bin>cd ..
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src>cd tools/dfu
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src\tools\dfu>python device_page_generator.py -d nrf52832_xxAA -sd "s132_5.0.0"
    Wrote device page for nrf52832_xxAA with the s132_5.0.0 SoftDevice to bin/device_page_nrf52832_xxAA_s132_5.0.0.hex.
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src\tools\dfu>cd ..
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src\tools>cd ..
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src>nrfjprog --eraseall
    Erasing user available code and UICR flash areas.
    Applying system reset.
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src>nrfjprog --eraseall
    Erasing user available code and UICR flash areas.
    Applying system reset.
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src>nrfjprog --program bin/bootloader/gccarmemb/mesh_bootloader_serial_gccarmemb_nrf52832_xxAA.hex
    Parsing hex file.
    Reading flash area to program to guarantee it is erased.
    Checking that the area to write is not protected.
    Programing device.
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src>nrfjprog --program bin/bootloader/gccarmemb/mesh_bootloader_serial_gccarmemb_nrf52832_xxAA.hex
    Parsing hex file.
    Reading flash area to program to guarantee it is erased.
    Checking that the area to write is not protected.
    Programing device.
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src>mesh-sdk$ nrfjprog --eraseall
    'mesh-sdk$' n’est pas reconnu en tant que commande interne
    ou externe, un programme exécutable ou un fichier de commandes.
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src>nrfjprog --eraseall
    Erasing user available code and UICR flash areas.
    Applying system reset.
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src>nrfjprog --eraseall
    Erasing user available code and UICR flash areas.
    Applying system reset.
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src>nrfjprog --program bin/softdevice/s132_nrf52_5.0.0_softdevice.hex --chiperase
    Parsing hex file.
    Erasing user available code and UICR flash areas.
    Applying system reset.
    Checking that the area to write is not protected.
    Programing device.
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src>nrfjprog --program bin/softdevice/s132_nrf52_5.0.0_softdevice.hex --chiperase
    Parsing hex file.
    Erasing user available code and UICR flash areas.
    Applying system reset.
    Checking that the area to write is not protected.
    Programing device.
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src>nrfjprog --program bin/bootloader/gccarmemb/mesh_bootloader_serial_gccarmemb_nrf52832_xxAA.hex
    Parsing hex file.
    Reading flash area to program to guarantee it is erased.
    Checking that the area to write is not protected.
    Programing device.
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src>nrfjprog --program bin/bootloader/gccarmemb/mesh_bootloader_serial_gccarmemb_nrf52832_xxAA.hex
    Parsing hex file.
    Reading flash area to program to guarantee it is erased.
    Checking that the area to write is not protected.
    Programing device.
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src>nrfjprog --program examples\dfu\build\dfu_nrf52832_xxAA_s132_5.0.0_Debug\dfu_nrf52832_xxAA_s132_5.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.
    Programing device.
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src>nrfjprog --program examples\dfu\build\dfu_nrf52832_xxAA_s132_5.0.0_Debug\dfu_nrf52832_xxAA_s132_5.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.
    Programing device.
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src>nrfjprog --program tools/dfu/bin/device_page_nrf52832_xxAA_s132_5.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.
    Programing device.
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src>nrfjprog --program tools/dfu/bin/device_page_nrf52832_xxAA_s132_5.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.
    Programing device.
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src>nrfjprog --reset
    Applying system reset.
    Run.
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src>nrfjprog --reset
    Applying system reset.
    Run.
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src>nrfutil --verbose dfu serial -pkg dfu_test.zip -p COM10 -b 115200 -fc --mesh
    Usage: nrfutil dfu serial [OPTIONS]
    
    Error: Invalid value for "-pkg" / "--package": Path "dfu_test.zip" does not exist.
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src>nrfutil --verbose dfu serial -pkg bin\blinky\dfu_test.zip -p COM10 -b 115200 -fc --mesh
    Upgrading target on COM10 with DFU package C:\Users\Mariem\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src\bin\blinky\dfu_test.zip. Flow control is enabled.
      [------------------------------------]    0%Flushing com-port...
    Opened com-port
    Starting DFU upgrade of type 4, SoftDevice size: 0, bootloader size: 0, application size: 1932
    Sending DFU start packet, afterwards we wait for the flash on target to be initialized before continuing.
    PC -> target: 0502aabbccdd
    PC -> target: 0502aabbccdd
    PC -> target: 0502aabbccdd
    PC -> target: 0502aabbccdd
    PC -> target: 0502aabbccdd
    
    
    Failed to upgrade target. Error is: Failed to establish connection
    
    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.
    Closing serial port...
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src>

    Thank you,

  • Hello,

    Can you try to run the script in the path:

    mesh_v2.0.1\tools\dfu\bootloader_verify.py like this:

    python bootloader_verify.py <serial number> <COM port>

    And see what it prints?

     

    Best regards,

    Edvin

     

  • Hi,

    I ran the command and here what it it prints

    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src\tools\dfu>python bootloader_verify.py 682501995 COM10
    Device family:                  NRF52
    Reading UICR..                  OK.
    Reading Device page..           OK.
    Resetting device..    

    I put the serial number of my serial device (host) and its COM port, 

    Now I tried with the other device and I put its serial number and COM port, and here what it shows

    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src\tools\dfu>python bootloader_verify.py 682609257 COM15
    Device family:                  NRF52
    Reading UICR..                  OK.
    Reading Device page..           OK.
    Resetting device..              OK (In application)
    Checking serial connection..    OK.
    
    Bootloader verification OK.
    
    C:\Users\Arij\Desktop\mesh\nrf5_SDK_for_Mesh_v2.0.0_src\nrf5_SDK_for_Mesh_v2.0.0_src\tools\dfu>nrfjprog --reset
    Applying system reset.
    Run.

    So I think here the bootloader worked with my other device that is supposed to be the target and not with host device, they are both connected to pc with USB cables. I'm still understanding the process of DFU over mesh, Do I have to restart all over again the dfu start guide and see if it works with my other device?

    Thank you,

     

  • Update:

    It works now finally and my two DK start blinking, now I want to use light switch server example instead of blinky application, is that possible? I believe DFU over mesh doesn't support big application like light switch demo, is that correct? 

  • Hello,

    That is great news. Did you find out what the problems was?

     

    It should work, but be aware that the Mesh DFU has a very low throughput. I haven't tested with the v2.0.1, but I tested with v1.0.1 some time ago. I just modified the DFU example to turn on different LEDs, and uploaded that project via DFU. So it should work with larger projects as well (I see no reason why it shouldn't work in SDK_v2.0.1).

     

    But as I mentioned, the throughput in Mesh is quite low, so the DFU process took about an hour. The advantage with Mesh DFU is that the DFU process runs in the background of the application, so for an in field DFU, the customer may start the update, but they can use the device as normal until the update is done. This will trigger a reset, and the device will run the new application. It is not that easy to see in the DFU example, because it does nothing else. But if you add a bootloader to the blinky example, or the blinky functionality to the DFU example, or the light switch example, you can see that the device is operative during the DFU process.

     

    Mesh DFU is intended for in field updates. If you just want to tweak parameters or something, I suggest that you program the chip normally, and just run a DFU test in the end before shipping out the firmware.

     

    Best regards,

    Edvin

Related