DFU for external BLE Sensor

Hi,

  I have a current project that is based on the nRf52840.  This project acts both as a peripheral and a central.  I have a need to update the firmware on a remote BLE sensor using DFU, i.e., I need to do exactly what the nRfConnect application does when it updates a peripheral firmware via DFU.  My thought was to use the nRf52840 dongle and develop this code on my PC and then port it to my embedded system.  I also thought the best starting point would be the source code for the nRfConnect application which I would port it but I see from user comments that nordic did not release the source code for this.  Is it possible to get this source code or is there another example that demonstrates what I need to accomplish?

Thanks!

  • Hi,

      I am still struggling with the integration of the SMP stuff into our real app, I detailed some issues in the last message.  The funny thing is that the SMP stuff is working in our real app now.  The addition of the SMP stuff into our real app has broken so many things now and I believe it is because our real app is based on an earlier SDK.  Is it possible to implement the SMP stuff in an earlier SDK?

  • Hi,

    I'm afraid I can't think of any obvious explanations to the 2 problems you described. Is there chance you can share this project here or in a private support ticket so I can try to review the project configuration?

    davidpatton said:
    Is it possible to implement the SMP stuff in an earlier SDK?

    Yes, but it will be more work if you use an older old SDK version. Which SDK/Softdevice are you using?

  • Hi Vidar,

      I have been unable to locate the last 3 bytes of the SHA in the image trailer.  I know what these 3 bytes are because I collected the entire OTA process between the nRFConnect android app and the Peripheral that is being updated.  I have attached both the RAW image file that contains the image header and image trailer as well as a "c" based header file that shows the HEX representation of the data in the RAW image file.  The SHA that is being sent for the files attached is:  0xD1, 0x01, 0x34

    The CBOR object that is sent with this is as follows:  char cSha[] = {0x63, 0x73, 0x68, 0x61, 0x43, 0xD1, 0x01, 0x34};

    I don't think the SHA is in the image file but if I am wrong can you point out where the SHA is inside the image file.  If the SHA is not in the image file I will need to be able to calculate the SHA myself in c code in the nRF5 SDK.  In this case can you provide some example code that performs this calculation?

    Thanks,

    Dave Patton

    480-00099-R1.27.2.1632834244_FOTA.binImage1.27.2.h

  • Hi,

      I took this project over from someone who no longer works at the company and I am not 100% sure which SDK it is based on, I just know it is an SDK prior to 16.  Is there a way to identify which SDK it is based on?  Yesterday I actually pulled the GATT QUEUE stuff from SDK 16, i.e., nrf_ble_gq.c and nrf_ble_gq.h as well as nrf_queue.c and nrf_queue.h and I was able to get our project working with the original SMP implementation that you provided so the weirdness that I described in the question from last week is thankfully gone.

    Thanks,

    Dave Patton

  • Hi Dave,

    One of our developers pointed out  to me that the sha256 sent along with the first packet (when offset == 0) is actually only of the data sent in that packet. In other words, this has digest not the same one that you will find in the image trailer:

    The nRF5 SDK includes a sha library in \components\libraries\sha256 that you can use.

    Vidar

Related