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, 

    Please describe to me what exactly you are trying to do ? 
    Are you trying to do DFU over Mesh as described here?
    Or are you trying to do DFU over BLE (non mesh) as described here ? 

    Please include all  the scripts you used to generate the .zip package and to perform DFU update. 

  • Hi Hung Bui,

    I'm trying to do DFU over Mesh as described here.

    Please see "mesh_dfu_command_20210407.txt" in the attached file.

    You can find several commands that I have executed for mesh DFU.

    Please let me know if the procedure is wrong.

    DevZone_0407.zip

    Is it possible to operate mesh DFU with the DFU file that is generated using "device_page_nrf52840_xxAA_s140_7.2.0.hex" ?

    Thanks in advance,

    Kunny

  • Hi Kunny, 

    Thanks for the detailed info. What you did seems to be good. I am not sure what could be wrong, but I suspect that there was not enough time for the DUT to erase flash pages to prepare for new image. 
    Could you please try to test with the blinky firmware as showed in the documentation ? The blinky firmware is much smaller than the image you are trying to update so it would requires much less time. 

    Please try to test updating the blinky without any private or public key generated (open DFU) so we know if it's the issue with the keys or not. 

    If the blinky image works ,but not your image, you can try to increase SEND_START_DFU_WAIT_TIME and SEND_DATA_PACKET_WAIT_TIME , please have a look at a similar case here: https://devzone.nordicsemi.com/f/nordic-q-a/39777/dfu-mesh-nrf_error_invalid_data-when-changing-application

  • Hi Hung Bui,

    Thank you for your co-operation.

    Could you please try to test with the blinky firmware as showed in the documentation ?

    I already did the above test.

    Please see the top of this topic. 

    The result is as follows:

    ###

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

    ###

    > If the blinky image works ,but not your image, you can try to increase 

    > SEND_START_DFU_WAIT_TIME and SEND_DATA_PACKET_WAIT_TIME.

    I tried the following combinations.

    But because of the error that described in the top of this topic,

    Serial communication doesn't work for all tests.

    [test1]

      SEND_START_DFU_WAIT_TIME = 2.0 (default)

      SEND_DATA_PACKET_WAIT_TIME = 1.0 (modified)

    [test2]

      SEND_START_DFU_WAIT_TIME = 2.0 (default)

      SEND_DATA_PACKET_WAIT_TIME = 2.0 (modified)

    [test3]

      SEND_START_DFU_WAIT_TIME = 2.0 (default)

      SEND_DATA_PACKET_WAIT_TIME = 3.0 (modified)

    [test4]

      SEND_START_DFU_WAIT_TIME = 5.0 (modified)

      SEND_DATA_PACKET_WAIT_TIME = 3.0 (modified)

    Do you have any idea to solve this issue?

    Thanks in advance,

    Kunny

  • Hi Kunny, 
    I'm sorry that I forgot about that you have successfully tested with blinky firmware. 

    I tried to test with your files and it worked fine for me. 

    You can find the log here, i used the same .zip file that you sent. 

    D:\Nordic\Deleteme\DFUMesh>nrfutil --verbose dfu serial -pkg dfu_test.zip -p COM14 -b 115200 -fc --mesh
    Upgrading target on COM14 with DFU package D:\Nordic\Deleteme\DFUMesh\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: 130832
    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: 1378fdff040f14287e9f04032120010002000000
    target -> PC: 16a6040403212001000200000004032120010001000000
    target -> PC: 1378fdff04000000000004032120010002000000
    target -> PC: 03847800
    1: PC -> target: 1378fdff040f14287e9f04032120010002000000
    target -> PC: 1378fdff040f14287e9f04032120010002000000
    target -> PC: 03847800
    Sending start packet
    1: PC -> target: 1478fcff000014287e9fffffffffc47f000040000c
    2: PC -> target: 1478fcff000014287e9fffffffffc47f000040000c
    target -> PC: 0da2010404032120010002000000
    target -> PC: 03847800
    target -> PC: 03847886
    Waiting for 4.4 seconds for flash bank erase to complete.
    Sending firmware file
      [------------------------------------]    1%  00:17:131: PC -> target: 1978fcff010014287e9f00f003206d7302005573020057730200
    target -> PC: 03847800
    1: PC -> target: 1978fcff020014287e9f597302005b7302005d73020000000000
    target -> PC: 03847800
    1: PC -> target: 1978fcff030014287e9f0000000000000000000000005f730200
    target -> PC: 03847800
    1: PC -> target: 1978fcff040014287e9f61730200000000006373020065730200
    target -> PC: 03847800
    1: PC -> target: 1978fcff050014287e9f6773020067730200a13f040067730200
    target -> PC: 03847800
    1: PC -> target: 1978fcff060014287e9f67730200677302003dca030067730200
    target -> PC: 03847800
    1: PC -> target: 1978fcff070014287e9f6773020067730200899e030067730200
    target -> PC: 03847800
    1: PC -> target: 1978fcff080014287e9f67730200677302006773020067730200
    target -> PC: 03847800
    1: PC -> target: 1978fcff090014287e9f11d303000538040069df020067730200
    target -> PC: 03847800
    1: PC -> target: 1978fcff0a0014287e9f6938040067730200ddcd030067730200
    target -> PC: 03847800
    1: PC -> target: 1978fcff0b0014287e9f67730200677302006773020067730200
    target -> PC: 03847800
    1: PC -> target: 1978fcff0c0014287e9f67730200677302000000000000000000
    target -> PC: 03847800
    1: PC -> target: 1978fcff0d0014287e9f67730200677302006773020067730200
    target -> PC: 03847800
    1: PC -> target: 1978fcff0e0014287e9f67730200677302006773020067730200
    target -> PC: 03847800
    1: PC -> target: 1978fcff0f0014287e9f67730200677302006773020000000000
    target -> PC: 03847800
    1: PC -> target: 1978fcff100014287e9f00000000677302000000000067730200
    target -> PC: 03847800
    1: PC -> target: 1978fcff110014287e9f00000000000000000000000000000000
    target -> PC: 03847800
    1: PC -> target: 1978fcff120014287e9f00000000000000000000000000000000
    target -> PC: 03847800
    1: PC -> target: 1978fcff130014287e9f00000000000000000000000000000000
    target -> PC: 03847800
    1: PC -> target: 1978fcff140014287e9f00000000000000000000000000000000
    target -> PC: 03847800
    1: PC -> target: 1978fcff150014287e9f00000000000000000000000000000000
    target -> PC: 03847800
    1: PC -> target: 1978fcff160014287e9f00000000000000000000000000000000
    target -> PC: 03847800
    1: PC -> target: 1978fcff170014287e9f00000000000000000000000000000000
    target -> PC: 03847800
    1: PC -> target: 1978fcff180014287e9f00000000000000000000000000000000
    target -> PC: 03847800
    1: PC -> target: 1978fcff190014287e9f00000000000000000000000000000000
    target -> PC: 03847800
    1: PC -> target: 1978fcff1a0014287e9f00000000000000000000000000000000
    target -> PC: 03847800
    1: PC -> target: 1978fcff1b0014287e9f00000000000000000000000000000000
    target -> PC: 03847800
    1: PC -> target: 1978fcff1c0014287e9f00000000000000000000000000000000
    target -> PC: 03847800
    1: PC -> target: 1978fcff1d0014287e9f00000000000000000000000000000000
    target -> PC: 03847800
    1: PC -> target: 1978fcff1e0014287e9f00000000000000000000000000000000
    target -> PC: 03847800
    1: PC -> target: 1978fcff1f0014287e9f00000000000000000000000000000000
    target -> PC: 03847800
    1: PC -> target: 1978fcff200014287e9f00000000000000000000000000000000
    target -> PC: 03847800
    1: PC -> target: 1978fcff210014287e9f344935480a1a02d0072291438d463349
    target -> PC: 03847800
    1: PC -> target: 1978fcff220014287e9f33480a1a06d00722914381f309880222
    target -> PC: 03847800
    1: PC -> target: 1978fcff230014287e9f82f314882f483049304a00f042f83048
    target -> PC: 03847800
    1: PC -> target: 1978fcff240014287e9f3049314a00f03df830483149314a00f0
    target -> PC: 03847800
    1: PC -> target: 1978fcff250014287e9f38f831483149324a00f033f831483249
    target -> PC: 03847800
    1: PC -> target: 1978fcff260014287e9f324a00f02ef832483249334a00f029f8
    target -> PC: 03847800
    1: PC -> target: 1978fcff270014287e9f32483349334a00f024f8334833490022
    target -> PC: 03847800
    1: PC -> target: 1978fcff280014287e9f00f02af832483349002200f025f83248
    target -> PC: 03847800
    1: PC -> target: 1978fcff290014287e9f3249091a082902db0022026041601f48
    target -> PC: 03847800
    1: PC -> target: 1978fcff2a0014287e9f1f49884205d00268043003b4904703bc
    target -> PC: 03847800
    1: PC -> target: 1978fcff2b0014287e9ff7e700208646ec4600200021284a9047
    target -> PC: 03847800
    1: PC -> target: 1978fcff2c0014287e9ffee7884207d0521a05d0037801300b70
    target -> PC: 03847800
    1: PC -> target: 1978fcff2d0014287e9f0131013af9d17047884202d002700130
    target -> PC: 03847800
    1: PC -> target: 1978fcff2e0014287e9ffae7704700f0032000e8032000f00320
    target -> PC: 03847800
    1: PC -> target: 1978fcff2f0014287e9f00f00320446e0400002e0020cc2e0020
    target -> PC: 03847800
    1: PC -> target: 1978fcff300014287e9fa0730200a073020074460400446e0400
    target -> PC: 03847800
    1: PC -> target: 1978fcff310014287e9f002e0020002e0020744a0400744a0400
    target -> PC: 03847800
    1: PC -> target: 1978fcff320014287e9f744a0400744a0400744a0400744a0400
    target -> PC: 03847800
    1: PC -> target: 1978fcff330014287e9f744a0400744a0400446e0400106f0400
    target -> PC: 03847800
    1: PC -> target: 1978fcff340014287e9fcc2e0020cc2e0020cc2e0020c0880020
    target -> PC: 03847800
    1: PC -> target: 1978fcff350014287e9fc0880020c0880020c0880020c08c0020
    target -> PC: 03847800
    1: PC -> target: 1978fcff360014287e9f71860200fee7fee7fee7fee7fee7fee7
    target -> PC: 03847800
    1: PC -> target: 1978fcff370014287e9ffee7fee7fee7fee700f002b8fff7fcbf
    target -> PC: 03847800
    1: PC -> target: 1978fcff380014287e9f08484ff0070188438546074880470748
    target -> PC: 03847800
    1: PC -> target: 1978fcff390014287e9f016841f470010160bff34f8fbff36f8f
    target -> PC: 03847800
    1: PC -> target: 1978fcff3a0014287e9ffff736bf00f0032005d1030088ed00e0
    target -> PC: 03847800
    1: PC -> target: 1978fcff3b0014287e9f34df704735df704741df70470378012b
    target -> PC: 03847800
    1: PC -> target: 1978fcff3c0014287e9f00d07047014b01221a70fae79c430020
    target -> PC: 03847800
    1: PC -> target: 1978fcff3d0014287e9fb9b91f2803d900f01f01124a02e00146
    target -> PC: 03847800
    1: PC -> target: 1978fcff3e0014287e9f4ff0a04201238b40c2f80c351f2816d9
    target -> PC: 03847800
    1: PC -> target: 1978fcff3f0014287e9f00f01f000b4a012303fa00f0c2f81805
    target -> PC: 03847800
    1: PC -> target: 1978fcff400014287e9f70471f2803d900f01f01064a02e00146
    target -> PC: 03847800
    1: PC -> target: 1978fcff410014287e9f4ff0a04201238b40c2f80835e6e74ff0
    target -> PC: 03847800
    1: PC -> target: 1978fcff420014287e9fa042e8e70003005008b500210d20fff7
    target -> PC: 03847800
    1: PC -> target: 1978fcff430014287e9fcfff00212020fff7cbff00211920fff7
    target -> PC: 03847800
    1: PC -> target: 1978fcff440014287e9fc7ff00211d20fff7c3ff00212d20fff7
    target -> PC: 03847800
    1: PC -> target: 1978fcff450014287e9fbfff00212c20fff7bbff00211f20fff7
    target -> PC: 03847800
    1: PC -> target: 1978fcff460014287e9fb7ff00210220fff7b3ff00210f20fff7
    target -> PC: 03847800
    1: PC -> target: 1978fcff470014287e9fafff00210c20fff7abff00212920fff7
    target -> PC: 03847800
    1: PC -> target: 1978fcff480014287e9fa7ff00210a20fff7a3ff00210920fff7
    target -> PC: 03847800
    1: PC -> target: 1978fcff490014287e9f9fff00210b20fff79bff00210420fff7
    target -> PC: 03847800
    1: PC -> target: 1978fcff4a0014287e9f97ff00211e20fff793ff00210520fff7
    target -> PC: 03847800
    1: PC -> target: 1978fcff4b0014287e9f8fff00211c20fff78bff00210320fff7
    target -> PC: 03847800
    1: PC -> target: 1978fcff4c0014287e9f87ff00211820fff783ff00211020fff7
    target -> PC: 03847800
    1: PC -> target: 1978fcff4d0014287e9f7fff00211320fff77bff00211120fff7
    target -> PC: 03847800
    1: PC -> target: 1978fcff4e0014287e9f77ff00211520fff773ff00211720fff7
    target -> PC: 03847800
    1: PC -> target: 1978fcff4f0014287e9f6fff00210720fff76bff00211a20fff7
    target -> PC: 03847800
    1: PC -> target: 1978fcff500014287e9f67ff00212f20fff763ff00212b20fff7
    target -> PC: 03847800
    1: PC -> target: 1978fcff510014287e9f5fff00212320fff75bff00212220fff7
    target -> PC: 03847800
    1: PC -> target: 1978fcff520014287e9f57ff00212820fff753ff00211420fff7
    target -> PC: 03847800
      [------------------------------------]    2%  00:30:021: PC -> target: 1978fcff530014287e9f4fff00211620fff74bff00211b20fff7
    target -> PC: 03847800
    1: PC -> target: 1978fcff540014287e9f47ff00210620fff743ff00212e20fff7
    target -> PC: 03847800
    1: PC -> target: 1978fcff550014287e9f3fff00212a20fff73bff00212120fff7
    target -> PC: 03847800
    1: PC -> target: 1978fcff560014287e9f37ff08bd30b583b015461c46134b1b68
    target -> PC: 03847800
    1: PC -> target: 1978fcff570014287e9f13f4804f03d0124b1b68032b08dc114b
    target -> PC: 03847800
    1: PC -> target: 1978fcff580014287e9f1b78237095f90230002b0fdb03b030bd
    target -> PC: 03847800
    1: PC -> target: 1978fcff590014287e9f0d4bd3f804350d4a01920d4a009240f2
    target -> PC: 03847800
    1: PC -> target: 1978fcff5a0014287e9fcd320c49042007f01ffde8e70a4b0122
    target -> PC: 03847800
    1: PC -> target: 1978fcff5b0014287e9f1a7000225a708023e370e7e7682e0020
    target -> PC: 03847800
    1: PC -> target: 1978fcff5c0014287e9f642e00208833002000100140a04e0400
    target -> PC: 03847800
    1: PC -> target: 1978fcff5d0014287e9ff84a0400ef4a04008433002010b582b0
    target -> PC: 03847800
    1: PC -> target: 1978fcff5e0014287e9f04460378022b35d0042b04d0012b54d0
    target -> PC: 03847800
    1: PC -> target: 1978fcff5f0014287e9f002002b010bd364b1b6813f4804f03d0
    target -> PC: 03847800
    1: PC -> target: 1978fcff600014287e9f344b1b68032b07dcb4f80f20b4f80530
    target -> PC: 03847800

     I attached here the files I used, including the nrfutil.exe file that I used, could you please try the same scripts (my script.txt) and test on your machine ? 
    Comparing the 2 logs from you and from me, it seems that the first packet send after "waiting for 4.4 seconds" was stuck in your case. 

     PC -> target: 1978fcff0100cc3a80fd00f003206d7302005573020057730200

    I suspect that 4.4 s might not be enough in your case (because of your chip might be slow for example) 


    Could you try to edit send_init_packet function inside dfu_transport_mesh.py to add extra sleeping time ? For example instead of *1.5 , you can try *3 :

    DFUMesh.zip

    Please try to also test on other DK board. 

Related