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

Write firmware to bank 1 from application

Hello.

I would like to know if its possible to preform a firmware update from the application itself like so:

1. Getting the firmware via UART in chunks of 2k (from a GSM modem).

2. Writing each chunk to Bank1.

3. Reset to DFU mode that will check if the data in Bank1 is valid.

4. If so, copy it to Bank0 and start the application.

If its possible, I would like to know how to write directly to bank1 from my application and how to reset to that DFU mode.

We are currently using SDK15.

Thanks and all the best,

Ofer.

Parents
  • Hello,

    Yes, it should be possible re-use our existing DFU and bootloader libraries for this. Please take a look at this thread : https://devzone.nordicsemi.com/f/nordic-q-a/46994/background-dfu-application-source-code and see if helps answer your questions. Requirements were mostly the same except this customer was planning to receive the image from a Wifi module.

    Best regards,

    Vidar

  • Hi Vidar,

    Thank you for the reply.

    I've read the thread you send and many others including this one. Please let me know if I got this correctly:

    From my application:

    1. Get Bank1 address by calling nrf_dfu_bank1_start_addr().

    2. Write the file I download to to that address (The file is the output of the nrfutil).

    3. Call nrf_dfu_validation_init_cmd_execute(<Bank1 address>, <file size>).

    4. If the return value is NRF_DFU_RES_CODE_SUCCESS, reset.

    In the bootloader: The nrf_bootloader_init will call nrf_bootloader_fw_activate and app_activate() the new firmware?

    All the best,
    Ofer.

  • Hi Ofer,

    The steps you outlined are not wrong, but normally you will want to decode and validate the init packet before you start receiving the FW image. What I generally recommend is to import and reuse the same DFU modules as the bootloader, same as I did in the example I uploaded to the other thread. The "nrf dfu" modules will take care of validation and storing of the new image for you. The missing piece will then be to create a custom transport to retrieve data from the modem and forward it as DFU requests to the nrf_dfu_req_handler.

    You can find the requirements for a DFU transport layer described in the "DFU protocol"chapter of the Bootloader documentation. Also, not sure if you are on SDK v.15.3.0 or v15.0.0, but note that 15.3.0 includes some bug fixes related to background DFU.

    Best regards,

    Vidar

Reply
  • Hi Ofer,

    The steps you outlined are not wrong, but normally you will want to decode and validate the init packet before you start receiving the FW image. What I generally recommend is to import and reuse the same DFU modules as the bootloader, same as I did in the example I uploaded to the other thread. The "nrf dfu" modules will take care of validation and storing of the new image for you. The missing piece will then be to create a custom transport to retrieve data from the modem and forward it as DFU requests to the nrf_dfu_req_handler.

    You can find the requirements for a DFU transport layer described in the "DFU protocol"chapter of the Bootloader documentation. Also, not sure if you are on SDK v.15.3.0 or v15.0.0, but note that 15.3.0 includes some bug fixes related to background DFU.

    Best regards,

    Vidar

Children
Related