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

SoftDevice size value in DFU init packet

Hello,

We are using nRF52840 with SDK 15.2.0, a bootloader and the SoftDevice 6.1.0. We are able to perform a DFU for our application by downloading the .bin and .dat files of the new firmware in Flash memory, to fill the DFU settings structure with the correct values, and after a reboot the bootloader updates our firmware as expected.

Now we would like to perform a DFU as the same way for the bootloader and the SoftDevice 6.1.1. With nRF Util we have created the .zip file for the BL+SD DFU and it works perfectly with BLE using nRF Connect. But for our own download process in Flash memory, when we fill the DFU settings, we need to know the SoftDevice size (variable dfu_settings.sd_size).

With nRF Util we can use the command "nrfutil pkg display my_file.zip" to read the following informations:

|- sd_size: 151016
|- bl_size: 24128

But we are not able to find where are stored these values in the .dat file. For this test, we have written directly in the code this value for SD and it works. So now we just need to read the value from the downloaded data to be able to perform a DFU with any SD size if needed. Can you explain where the SD and BL sizes are stored ?

Thanks for your help!

Parents Reply Children
  • Hi,

    Thanks for your answer, but even with the protobuf, the dfu-cc.pb.c and dfu-cc.pb.h files, the fields do not seem to be what we can see in the init packet (.dat file).

    We use nRF Util version 5.2.0 and this is the result of the "pkg display" command with the corresponding data. We have found some of the values but not the bootloader and SoftDevice sizes:

  • Hi,

    You cannot read values directly out of the file in hex like that, due to the way integers are stored in the protobuf format. Values 0-127 will read as normal, but anything above that will be different. Also, the number of bytes used for each value will vary, so the location of values may change depending on the size of the previous values. For details on the encoding, see the Encoding chapter of the Protocol Buffers developer guide from Google.

    For reading out the values, I recommend using a protobuf reading library. You can also have a look at the nrfutil source for reference.

    Regards,
    Terje

  • Thanks for the link, that's exactly what we needed. So for our SoftDevice size in the init packet, we can see these bytes starting at position 20:

    0xE8 0x9B 0x09
    ==> 11101000 10011011 00001001
    ==> 0001001 0011011 1101000 after removing MSB and reverse order
    ==> 151016 in decimal so now it works.

    Our problem is solved, thanks!

Related