nrf52840 DFU with external flash

Hi,

Are there any examples of doing DFU using the nrf52840-dk with external flash on a Zephyr project (nrf-sdk)?

We want to use the MX25R64 flash to host one of the partitions as the firmware is too large.

At this stage, we're not concerned about the update interface, BLE, LwM2M, UART, etc.

Simply enabling "CONFIG_BOOTLOADER_MCUBOOT=y" doesn't work as our firmware won't fit.

Thanks,

Sam

Parents
  • Are there any examples of doing DFU using the nrf52840-dk with external flash on a Zephyr project (nrf-sdk)?

    There is an example demonstrating this here: https://github.com/simon-iversen/sdk-zephyr/tree/serial_dfu_ext_flash_hello_world/samples/hello_world 

    Simply enabling "CONFIG_BOOTLOADER_MCUBOOT=y" doesn't work as our firmware won't fit.

    How large is your application? When you enable mcuboot, then three partitions will be created, which is the mcuboot, the primary slot and the secondary slot. By default, mcuboot uses 48kB I think (you can definitely reduce this size). If you haven't configured the secondary slot to be put in the external flash you might encounter issues if your appliation is large. What you have left in flash is roughly 1mb-48kB=952kb, so if your application is larger than 952/2=476 (primary and secondary needs to have the same size and be able to fit the application), it won't fit. In addition you may have some other flash partitions, like a storage partition.

    Best regards,

    Simon

Reply
  • Are there any examples of doing DFU using the nrf52840-dk with external flash on a Zephyr project (nrf-sdk)?

    There is an example demonstrating this here: https://github.com/simon-iversen/sdk-zephyr/tree/serial_dfu_ext_flash_hello_world/samples/hello_world 

    Simply enabling "CONFIG_BOOTLOADER_MCUBOOT=y" doesn't work as our firmware won't fit.

    How large is your application? When you enable mcuboot, then three partitions will be created, which is the mcuboot, the primary slot and the secondary slot. By default, mcuboot uses 48kB I think (you can definitely reduce this size). If you haven't configured the secondary slot to be put in the external flash you might encounter issues if your appliation is large. What you have left in flash is roughly 1mb-48kB=952kb, so if your application is larger than 952/2=476 (primary and secondary needs to have the same size and be able to fit the application), it won't fit. In addition you may have some other flash partitions, like a storage partition.

    Best regards,

    Simon

Children
  •   This is exactly what I was after, thank you.

    I've modified our custom board profile & project as per the project linked. The new hardware with the storage chip hasn't arrived yet, but I will test on the DK board and get back to you.

    Our firmware is around 500-600kB so two partitions wouldn't fit onto the nrf52840's 1024kB flash. This is now solved using your project pm_static.yml file to put one partition into the flash chip.

    Do you happen to have an extended project using LwM2M as the update interface?

  • motters said:
    Simon  This is exactly what I was after, thank you.

    I'm happy I was able to help :) 

    motters said:
    Do you happen to have an extended project using LwM2M as the update interface?

    I found a sample under in <ncs location>\zephyr\samples\net\lwm2m_client. However, I don't know have much knowledge about the lwm2m protocol and how to use it on the 52840, could you open a new ticket about this? Then it will get assigned to an engineer who knows more about it.

  •   Sounds good. I'll spend some more time checking the dfu and open a new ticket on LwM2M dfu later on.

    Thanks again.

  • One thing that I forgot to mention. You could do the DFU update directly from MCUboot using serial recovery, then you only need a single slot since mcuboot will override the old application directly (mcuboot will then be the fallback, instead of preserving the old application).

    I don't think you will be able to add any more replies to this ticket, since the status is set to "verified answer"

Related