Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Updating data (non-firmware) on QSPI using DFU OTA firmware update

I am using the nRF 5 SDK 17.1, with the un-modified Secure bootloader from the Examples, and with a simple application packaged as zip I can get it uploaded  and running Ok on the device (nRF52840) by DFU OTA.

Currently I am using an OLED display, with its screen data (a Logo) stored in QSPI starting at address 0x12000000.

What I would like to achieve is: to be able to update the OLED data stored on QSPI via DFU OTA.

I have tried to manually arrange the data to be stored on QSPI in a hex file, using the hex file format, and then fixing the QSPI offset in it with:

objcopy -v -I ihex -O ihex --change-addresses 0x12000000 myhex.hex final.hex


then I can program and verify that new data was stored in QSPI using:

// write the file to QSPI
nrfjprog -f nRF52 --qspiini cfg_mydevice.toml --program final.hex --qspichiperase --verify final.hex


I have tried to use "mergehex" to add the screen data ("final.hex") for QSPI to the application hex file and then packing it for DFU with nrfutil.

The result was that the firmware was updated Ok but the QSPI was not written to, probably the bootloader has to be modified.

Question is:   How could I store some data (not executable)  to QSPI via DFU OTA ?

  • Hello,

    The bootloader determines where to store the update solely based on what update type is specified in the init command (application, external application, Softdevice or bootloader). The address information contained in the hex file is lost when it is converted to a binary file in the DFU package. In other words, the bootloader has no way of knowing if there is data contained in the application image that belongs to the XiP region @ 0x12000000.

    Possible solutions:

    1. Create a separate DFU package for the QSPI data using the nrfutil '--external-app' option and modify the bootloader to copy "external app images" to the QSPI flash.

    2. Implement a mechanism in the application to receive and update QSPI flash data that does not rely on our DFU protocol. 

    Best regards,

    Vidar

  • Thank you Vidar,

    Even though I like the first solution I am not sure I know what and where I should modify the bootloader, I will read on that.

    Guess I will have to go for the second solution for now, but I will not abandon the your first solution as I believe it is the best one.

    Best regards,
    Gabi

  • Hi Gabi,

    We do not have examples to demonstrate how external application images can be handled as it would have to be specific to the third-party device you are targeting. In this case it will be a QSPI flash, but in other cases it could be another MCU, etc. I do not really think it would be feasible to make a generic example for this.

    If you want to go with this approach, you can search for "NRF_DFU_SUPPORTS_EXTERNAL_APP" in the project to find relevant code sections. The nrf_dfu_validation.c:nrf_dfu_validation_post_external_app_execute() function is left for the user to implement.

    Best regards,

    Vidar

  • Great !

    All very clear Vidar, and makes sense. I was just looking for advice and now I have it through your swift support.

    Was actually just reading on them in sdk_config.h  and nrf_dfu_validation.c

    Much appreciated!

    Best regards,
    Gabi.

Related