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

About Mesh DFU Test

         1.      I used the nRF5 SDK for Mesh v2.2.0 version to test the Mesh DFU feature and follow the DFU example tutorial.

               http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.meshsdk.v2.2.0%2Fmd_doc_getting_started_getting_started.html     ------->DFU quick start guide

         2.      The upgraded application is blinky_nrf52840_xxAA_s140_6.0.0.hex. After the upgrade is complete, I want to upgrade the second time, but it is not successful.

                  mesh-sdk$ nrfutil dfu genpkg --application bin/blinky/blinky_nrf52832_xxAA_s132_6.0.0.hex \

                  --company-id 0x00000059 \
                  --application-id 1 \
                  --application-version 2 \
                  --key-file private_key.txt \
                  --sd-req 0x009D \
                  --mesh dfu_test.zip

         3.      Then I went to check the source code of the DFU upgrade, so I think the application blinky_nrf52840_xxAA_s140_6.0.0.hex is not equipped with DFU function, just for flash led.

                  

         4.     Finally, I tried to clear the device program and re-run the first upgrade, but the application selected the hex program compiled by the DFU routine. The file size is about 300K, but the upgrade is very slow, and finally there is no upgrade.

               nrfutil dfu genpkg --application examples/NOA_dfu/build/dfu_nrf52840_xxAA_s140_6.0.0_Debug/dfu_nrf52840_xxAA_s140_6.0.0.hex --company-id 0x00000059 --application-id 1 --application-version 3 --key-file private_key.txt --sd-req 0x009D --mesh dfu_test.zip

         I want to know if my understanding is accurate. And whether the application must be modified based on the DFU example, under the premise that the MESH DFU function is required

Parents
  • Hi,

    It should work to do the DFU multiple times. Like the documentation states, you will need to do this:

    "To try another DFU, re-run steps 3 and 10 with an increased version number, for example --application-version 3, and use the new zip file to do the DFU again."

    If you have not already created a script, I would start there. Then, I would erase the boards completely & start from scratch one more time. 

    How many dev kits are you testing with atm?

    Regarding your 4th point, I would delete all of the zip files generated & start from scratch. Then, it should work to do the DFU multiple times.

    Kind Regards,

    Bjørn

  • I am very sorry, because I can see your reply next week.

    I want to ask a question here, I run the Mesh light_switch routine.

    Data can only be bidirectional from server to client. It can't be from the server to the server, or the client. I tried to read the client and server code and found it difficult and took a lot of time.

    I would like to ask if there is a corresponding example, sent directly from the client to the client.

Reply
  • I am very sorry, because I can see your reply next week.

    I want to ask a question here, I run the Mesh light_switch routine.

    Data can only be bidirectional from server to client. It can't be from the server to the server, or the client. I tried to read the client and server code and found it difficult and took a lot of time.

    I would like to ask if there is a corresponding example, sent directly from the client to the client.

Children
  • I will test the dfu functionality with two 52840 dks & get back to you on that. Why should the server not be able to send an acknowledged message to another server? That way, a server sends a set message to another server for example & the receiving server will respond to the sender with a status message.

    Right now, the light switch server example is setup to send a status message back to the client, but you should be able to update that to send a reliable unicast message to another server. What you could do is add the generic on off client model in the light switch server example. A similar example is shown here, where I have updated the light switch example to be both a server & a client (by adding the generic on off client model in the server example). By provisioning via the nRF Mesh app (available for Android & iOS), you are able to use the device as both a light switch & a light (i.e. client or server). Just beware that the example uses a slightly simplified version of the "generic on off model". Therefore, I would use the github example as a good starting point, but maybe rather update the mesh sdk v2.2.0 light switch example to achieve the same thing.

    If you want a quick way to send messages from one client to another client, I would test out the github code. There are two pdfs that show the testing guidelines.

    I agree that Bluetooth Mesh is not the simplest of things to learn. I have spent quite a lot of time supporting Bluetooth Mesh & there are definitely easier examples to understand. ;) 

  •      Thank you very much for your reply and look forward to your testing of the NRF52840 Mesh.

         I will try to modify the code to implement server to server communication, or client and client communication

  • I also want to know the communication protocol between nrfutil and the device in the Mesh DFU function. We want to implement DFU function through other serial ports, such as WiFi module and NRF52840.

    Can you provide this communication protocol to us?

  • Sorry for the delayed response. I have finished testing the DFU bootloader example. I essentially just followed the Getting Started with DFU documentation that you looked at.

    As you can see from the picture below, the bootloader is still there after you perform the DFU. 

    However, as you pointed out, the blinky application does not support DFU. When I tried to do the DFU the second time around, I got the same error you did.

    What I did next was to first erase one of the boards, then run the following commands on that board:

    nrfjprog --eraseall
    nrfjprog --program ../../bin/softdevice/s140_nrf52_6.0.0_softdevice.hex --chiperase
    nrfjprog --program ../../bin/bootloader/gccarmemb/mesh_bootloader_serial_gccarmemb_nrf52840_xxAA.hex --verify
    nrfjprog --program ../../examples/dfu/build/dfu_nrf52840_xxAA_s140_6.0.0_Debug/dfu_nrf52840_xxAA_s140_6.0.0.hex  --verify
    nrfjprog --program ../../tools/dfu/bin/device_page_nrf52840_xxAA_s140_6.0.0.hex
    nrfjprog --reset
    nrfutil_mesh dfu serial -pkg dfu_test_blinky.zip -p COM29 -b 115200 -fc --mesh

    You can naturally just use nrfutil instead of nrfutil_mesh. Since I use both quite often, I decided to rename the mesh version nrfutil_mesh. Once I made those changes, everything worked fine like it should.

    Also, in case you have not created a bat script, I have uploaded one below to make this whole process a lot easier & more enjoyable. Just replace the SEGGER_ID with the IDs on the top of the interface MCU on your 52 DKs.

    I used three DKs during this test, but you can easily use 2 or even more if you really want to test it out more!

    echo @off
    
    title Start Mesh v2.2.0 DFU process!
    echo Start DFU
    
    nrfutil_mesh keys --gen-key private_key.txt
    nrfutil_mesh keys --show-vk hex private_key.txt
    
    pause
    
    echo Add public key info to tools/dfu/bootloader_config_default.json file
    
    echo Generating DFU zip file
    
    nrfutil_mesh dfu genpkg --application ../../bin/blinky/blinky_nrf52840_xxAA_s140_6.0.0.hex --company-id 0x00000059 --application-id 1 --application-version 2 --key-file private_key.txt --sd-req 0x00A9 --mesh dfu_test_blinky.zip
    	
    
    	
    echo generate hex version of device page
    rem Device page generator requires Python 2.7
    
    rem python ../../tools/dfu/device_page_generator.py -d nrf52840_xxAA -sd "s140_6.0.0"
    
    
    
    echo Erase chip memory on all devices
    
    nrfjprog --eraseall -s <SEGGER ID>
    nrfjprog --eraseall -s <SEGGER ID>
    nrfjprog --eraseall -s <SEGGER ID>
    
    echo Flash softdevice on all devices
    
    nrfjprog --program ../../bin/softdevice/s140_nrf52_6.0.0_softdevice.hex -s <SEGGER ID> --chiperase
    nrfjprog --program ../../bin/softdevice/s140_nrf52_6.0.0_softdevice.hex -s <SEGGER ID> --chiperase
    nrfjprog --program ../../bin/softdevice/s140_nrf52_6.0.0_softdevice.hex -s <SEGGER ID> --chiperase
    
    echo Flash serial BL on all dfu
    
    nrfjprog --program ../../bin/bootloader/gccarmemb/mesh_bootloader_serial_gccarmemb_nrf52840_xxAA.hex -s <SEGGER ID> --verify
    nrfjprog --program ../../bin/bootloader/gccarmemb/mesh_bootloader_serial_gccarmemb_nrf52840_xxAA.hex -s <SEGGER ID> --verify
    nrfjprog --program ../../bin/bootloader/gccarmemb/mesh_bootloader_serial_gccarmemb_nrf52840_xxAA.hex -s <SEGGER ID> --verify
    
    echo Flash DFU app on all devices
    
    nrfjprog --program ../../examples/dfu/build/dfu_nrf52840_xxAA_s140_6.0.0_Debug/dfu_nrf52840_xxAA_s140_6.0.0.hex -s <SEGGER ID>  --verify
    nrfjprog --program ../../examples/dfu/build/dfu_nrf52840_xxAA_s140_6.0.0_Debug/dfu_nrf52840_xxAA_s140_6.0.0.hex -s <SEGGER ID>  --verify
    nrfjprog --program ../../examples/dfu/build/dfu_nrf52840_xxAA_s140_6.0.0_Debug/dfu_nrf52840_xxAA_s140_6.0.0.hex -s <SEGGER ID>  --verify
    
    echo Flash device page on all devices
    
    nrfjprog --program ../../tools/dfu/bin/device_page_nrf52840_xxAA_s140_6.0.0.hex -s <SEGGER ID>
    nrfjprog --program ../../tools/dfu/bin/device_page_nrf52840_xxAA_s140_6.0.0.hex -s <SEGGER ID>
    nrfjprog --program ../../tools/dfu/bin/device_page_nrf52840_xxAA_s140_6.0.0.hex -s <SEGGER ID>
    
    echo Soft reset all devices
    
    nrfjprog --reset -s <SEGGER ID>
    nrfjprog --reset -s <SEGGER ID>
    nrfjprog --reset -s <SEGGER ID>
    
    echo Start DFU
    nrfutil_mesh dfu serial -pkg dfu_test_blinky.zip -p COM29 -b 115200 -fc --mesh
    
    pause
    

    Regarding the communication protocol, I believe we just use the serial interface. Hope that helps!

    Kind Regards,

    Bjørn

  • Sorry for the delayed response. I have finished testing the DFU bootloader example. I essentially just followed the Getting Started with DFU documentation that you looked at.

    As you can see from the picture below, the bootloader is still there after you perform the DFU. 

    However, as you pointed out, the blinky application does not support DFU. When I tried to do the DFU the second time around, I got the same error you did.

    What I did next was to first erase one of the boards, then run the following commands on that board:

    nrfjprog --eraseall
    nrfjprog --program ../../bin/softdevice/s140_nrf52_6.0.0_softdevice.hex --chiperase
    nrfjprog --program ../../bin/bootloader/gccarmemb/mesh_bootloader_serial_gccarmemb_nrf52840_xxAA.hex --verify
    nrfjprog --program ../../examples/dfu/build/dfu_nrf52840_xxAA_s140_6.0.0_Debug/dfu_nrf52840_xxAA_s140_6.0.0.hex  --verify
    nrfjprog --program ../../tools/dfu/bin/device_page_nrf52840_xxAA_s140_6.0.0.hex
    nrfjprog --reset
    nrfutil_mesh dfu serial -pkg dfu_test_blinky.zip -p COM29 -b 115200 -fc --mesh

    You can naturally just use nrfutil instead of nrfutil_mesh. Since I use both quite often, I decided to rename the mesh version nrfutil_mesh. Once I made those changes, everything worked fine like it should.

    Also, in case you have not created a bat script, I have uploaded one below to make this whole process a lot easier & more enjoyable. Just replace the SEGGER_ID with the IDs on the top of the interface MCU on your 52 DKs.

    I used three DKs during this test, but you can easily use 2 or even more if you really want to test it out more!

    echo @off
    
    title Start Mesh v2.2.0 DFU process!
    echo Start DFU
    
    nrfutil_mesh keys --gen-key private_key.txt
    nrfutil_mesh keys --show-vk hex private_key.txt
    
    pause
    
    echo Add public key info to tools/dfu/bootloader_config_default.json file
    
    echo Generating DFU zip file
    
    nrfutil_mesh dfu genpkg --application ../../bin/blinky/blinky_nrf52840_xxAA_s140_6.0.0.hex --company-id 0x00000059 --application-id 1 --application-version 2 --key-file private_key.txt --sd-req 0x00A9 --mesh dfu_test_blinky.zip
    	
    
    	
    echo generate hex version of device page
    rem Device page generator requires Python 2.7
    
    rem python ../../tools/dfu/device_page_generator.py -d nrf52840_xxAA -sd "s140_6.0.0"
    
    
    
    echo Erase chip memory on all devices
    
    nrfjprog --eraseall -s <SEGGER ID>
    nrfjprog --eraseall -s <SEGGER ID>
    nrfjprog --eraseall -s <SEGGER ID>
    
    echo Flash softdevice on all devices
    
    nrfjprog --program ../../bin/softdevice/s140_nrf52_6.0.0_softdevice.hex -s <SEGGER ID> --chiperase
    nrfjprog --program ../../bin/softdevice/s140_nrf52_6.0.0_softdevice.hex -s <SEGGER ID> --chiperase
    nrfjprog --program ../../bin/softdevice/s140_nrf52_6.0.0_softdevice.hex -s <SEGGER ID> --chiperase
    
    echo Flash serial BL on all dfu
    
    nrfjprog --program ../../bin/bootloader/gccarmemb/mesh_bootloader_serial_gccarmemb_nrf52840_xxAA.hex -s <SEGGER ID> --verify
    nrfjprog --program ../../bin/bootloader/gccarmemb/mesh_bootloader_serial_gccarmemb_nrf52840_xxAA.hex -s <SEGGER ID> --verify
    nrfjprog --program ../../bin/bootloader/gccarmemb/mesh_bootloader_serial_gccarmemb_nrf52840_xxAA.hex -s <SEGGER ID> --verify
    
    echo Flash DFU app on all devices
    
    nrfjprog --program ../../examples/dfu/build/dfu_nrf52840_xxAA_s140_6.0.0_Debug/dfu_nrf52840_xxAA_s140_6.0.0.hex -s <SEGGER ID>  --verify
    nrfjprog --program ../../examples/dfu/build/dfu_nrf52840_xxAA_s140_6.0.0_Debug/dfu_nrf52840_xxAA_s140_6.0.0.hex -s <SEGGER ID>  --verify
    nrfjprog --program ../../examples/dfu/build/dfu_nrf52840_xxAA_s140_6.0.0_Debug/dfu_nrf52840_xxAA_s140_6.0.0.hex -s <SEGGER ID>  --verify
    
    echo Flash device page on all devices
    
    nrfjprog --program ../../tools/dfu/bin/device_page_nrf52840_xxAA_s140_6.0.0.hex -s <SEGGER ID>
    nrfjprog --program ../../tools/dfu/bin/device_page_nrf52840_xxAA_s140_6.0.0.hex -s <SEGGER ID>
    nrfjprog --program ../../tools/dfu/bin/device_page_nrf52840_xxAA_s140_6.0.0.hex -s <SEGGER ID>
    
    echo Soft reset all devices
    
    nrfjprog --reset -s <SEGGER ID>
    nrfjprog --reset -s <SEGGER ID>
    nrfjprog --reset -s <SEGGER ID>
    
    echo Start DFU
    nrfutil_mesh dfu serial -pkg dfu_test_blinky.zip -p COM29 -b 115200 -fc --mesh
    
    pause
    

    Regarding the communication protocol, I believe we just use the serial interface. Hope that helps!

    Kind Regards,

    Bjørn

Related