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

Configuring and performing DFU over Mesh

I have a question about how to perform DFU over Mesh.

I'm using nRF52840 device.

Following the steps at the URL below (Configuring and performing DFU over Mesh), I'm trying Mesh DFU which is a combination of Mesh5.0 s140_7.2.0.

 

[URL]

https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.meshsdk.v4.0.0%2Fmd_doc_libraries_dfu_dfu_quick_start.html

 

But, I could not generate a DFU file on Step 1(Generate a DFU archive with nrfutil).

At that time, I got some errors.

Could you please tell me why I could not generate the DFU file ?

I explain details of the problem at the follows.

 

[the problem]

When I tried to generate a DFU file with "blinky_nrf52840_xxAA_s140_7.2.0.hex"

in the located of "nrf5_SDK_for_Mesh_v5.0.0_src\bin\blinky",

I got the following error:

 

"pc-nrfutil\nordicsemi\intelhex\__init__.py", line 342, in _tobinarray_really raise ValueError("tobinarray: wrong value for size")

ValueError: tobinarray: wrong value for size

 

In order to analyze the above problem,

I tried to perform which is a combination of Mesh4.2,following the steps at the URL.

And then, it worked fine.

So, I compared "blinky_nrf52840_xxAA_s140_7.2.0.hex" with "blinky_nrf52840_xxAA_s140_7.0.1.hex"

that has used as the update application of Mesh 4.2.

The file structure and the mapped address look very different.

I guess that "blinky_nrf52840_xxAA_s140_7.2.0.hex" has some problem.

That's why I could not generate the DFU file.

Please tell me your opinion.

 

Thanks in advance.

  • Hi Kunny, 
    I had a look at the file and it seems that the first line was missing or it doesn't follow Intelhex format properly. 

    Please try to test again using any example that you compile to work with S140 v7.2.0. You can modify blinky example in nRF5 SDK so that it work with S140 softdevice to test. 
    I attached here the .hex file that I compiled using the blinky example in the \nRF5_SDK_17.0.2_d674dde\examples\peripheral\blinky\ folder (with modification of start address so that it works with the softdevice) 

    Please test using this image. 

    1832.blinky_pca10056.hex

  • Hi Hung Bui,

    Thanks to you,
    I could generate the DFU file using "1832.blinky_pca10056.hex" that you sent.
    And then, Mesh DFU which is a combination of Mesh5.0 and s140_7.2.0 worked fine.
    Thank you for your co-operation.

    I have another question as follows.

    [Q1]
    I could performed Mesh DFU which is a combination of Mesh5.0 and s140_7.2.0 using sample hex file "1832.blinky_pca10056.hex".
    Next, I'm going to perform Mesh DFU using hex file(update application) that I created.
    So I have a question about how to create that hex file(update application).
    Are there any restrictions on creating a hex file?
    For example, there are restrictions such as memory mapping.
    If there are any restrictions, could you please tell me the specification for their restrictions.
    If you have any reference documents, please let me know.

    Basically, I understand that I can create an updated firmware by following the firmware configuration below that is used when checking the operation of Mesh DFU (tutorial).
    So, I will add the necessary code based on "dfu_nrf52840_xxAA_s140_7_2_0.emProject" in the located of "nrf5_SDK_for_Mesh_v5.0.0_src\examples\dfu".

    [Q2]
    I think there are two way to perform mesh DFU.
    It is the way of serial interface and Bluetooth interface.
    I already executed mesh DFU using serial interface.
    So, I want to try to perform mesh DFU using Bluetooth interface.
    Do you have any sample program to perform mesh DFU using Bluetooth interface?
    If it is not available now, do you have plan to release such a sample program?

    Thanks in advance.
    Kunny

  • Hi Kunny,

    Any application that's configured for the same softdevice on the mesh board can be used. Basically it just need to have correct start address in flash (right after the softdevice). 
    But be aware that, if the application doesn't have DFU support included in the firmware, you can't do a DFU after you update the firmware. For example the blinky hex file I provided. You can't update it to another firmware after you update blinky because blinky doesn't have any DFU support in the code. 
    You would need to refer to the dfu_nrf52840_xxAA_s140_7_2_0.emProject project example and implement the same into your application. 

    2. No there currently no Mesh DFU over BLuetooth. If you want to have BLE DFU (which is not mesh) you would need to remove the mesh bootloader and flash the BLE bootloader. But when you do that you can only update one node at a time and have to go to each node to do DFU. When with mesh DFU you just need to send the image to one node via UART then it will be distributed to the whole network. 

    It's possible to implement your own proprietary protocol to send the image via BLE and then have the image be distributed to the whole mesh network. But we don't have such example available. 

  • Hi Hung Bui,

    Thank you for your explanation.

    I will follow your explanation and try running Mesh DFU using the hex file (update application) that I created.

    Thank you for your co-operation,

    Kunny

  • Hi Hung Bui,

    I followed your explanation and tried running Mesh DFU.

    I took the following step to create dfu file(zip file) :

    (1) I use dfu_nrf52840_xxAA_s140_7.2.0.hex as initial FW.
         This is generated from
         nrf5_SDK_for_Mesh_v5.0.0_src\examples\dfu\dfu_nrf52840_xxAA_s140_7_2_0.emProject.

    (2) I generate dfu file(zip file) using dfu_nrf52840_xxAA_s140_7.2.0.hex.

    (3) I check the operation of DFU.

    But, it didn't work.
    When it has sent the first packet, "ERROR_INVALID_DATA(135)" occurred.

    The Log is as follows:

    =====

    Upgrading target on COM23 with DFU package C:\Users\hmU11504\Desktop\work_mesh_dfu_20210304\work_20210304\dfu_test.zip. Flow control is enabled.
    Flushing com-port...
    Opened com-port
    Starting DFU upgrade of type 4, SoftDevice size: 0, bootloader size: 0, application size: 130404
    Sending DFU start packet, afterwards we wait for the flash on target to be initialized before continuing.
    1: PC -> target: 0502aabbccdd
    target -> PC: 0582aabbccdd
    Got echo response
    Sending DFU init packet
    Sending ready packet
    1: PC -> target: 1378fdff040fcc3a80fd04032120010002000000
    target -> PC: 16a6040403212001000200000004032120010001000000
    target -> PC: 1378fdff04000000000004032120010002000000
    target -> PC: 03847800
    1: PC -> target: 1378fdff040fcc3a80fd04032120010002000000
    target -> PC: 1378fdff040fcc3a80fd04032120010002000000
    target -> PC: 03847800
    Sending start packet
    1: PC -> target: 1478fcff0000cc3a80fdffffffff597f000040000c
    2: PC -> target: 1478fcff0000cc3a80fdffffffff597f000040000c
    3: PC -> target: 1478fcff0000cc3a80fdffffffff597f000040000c
    4: PC -> target: 1478fcff0000cc3a80fdffffffff597f000040000c
    5: PC -> target: 1478fcff0000cc3a80fdffffffff597f000040000c
    6: PC -> target: 1478fcff0000cc3a80fdffffffff597f000040000c
    target -> PC: 0da2010404032120010002000000
    target -> PC: 03847800
    Waiting for 4.4 seconds for flash bank erase to complete.
    Sending firmware file
    [------------------------------------] 1% 00:20:271: PC -> target: 1978fcff0100cc3a80fd00f003206d7302005573020057730200
    target -> PC: 03847887
    2: PC -> target: 1978fcff0100cc3a80fd00f003206d7302005573020057730200
    3: PC -> target: 1978fcff0100cc3a80fd00f003206d7302005573020057730200
    4: PC -> target: 1978fcff0100cc3a80fd00f003206d7302005573020057730200
    5: PC -> target: 1978fcff0100cc3a80fd00f003206d7302005573020057730200
    6: PC -> target: 1978fcff0100cc3a80fd00f003206d7302005573020057730200
    target -> PC: 73820055730200577302001978fcff0100cc3a80fd00f003206d73020055730200577302001978fcff0100cc3a80fd00f003206d73020055730200577302001978fcff0100cc3a80fd00f003206d73020055730200577302001978fcff0100cc3a80fd00f003206d730200557302005773020019
    7: PC -> target: 1978fcff0100cc3a80fd00f003206d7302005573020057730200
    8: PC -> target: 1978fcff0100cc3a80fd00f003206d7302005573020057730200
    9: PC -> target: 1978fcff0100cc3a80fd00f003206d7302005573020057730200
    10: PC -> target: 1978fcff0100cc3a80fd00f003206d7302005573020057730200
    target -> PC: 0384fc84


    Failed to upgrade target. Error is: Device returned status code ERROR_INVALID_DATA (135) on a DFU data packet.

    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.
    - if the error is ERROR_BUSY at the beginning of the DFU process,increase the value of PAGE_ERASE_TIME_MAX by few milliseconds.
    Closing serial port...

    =====

    I changed "SEND_START_DFU_WAIT_TIME" to 3.0/4.0/5.0/10.0.

    The situation was not change. It did not work.

    Could you please tell me what is wrong?

    Thanks a lot,
    Kunny

Related