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

Insufficient resources on DFU OTA

Hej,

on trying to update firmware on nrf52832 over the air I'm getting the error message INSUFFICIENT_RESOURCES.

Actually I don't understand the error message because if I generate the bootloader settings page for the firmware image and flash both hex files separately (the firmware and the bl settings page) everything works as expected. For our customers I wan't this firmware image to be updated using DFU OTA so I generate a zip file with nrfutil:

nrfutil pkg generate --hw-version 52 --application-version 1 --application myfirmware.hex --sd-req 0x8c --key-file ../keys/private.pem update_file.zip

I need to say that since our last update we added a ton of features and a huge binary blob of about 60 kB so that the resulting image has a size of 348 kB. Regarding the nrf52 memory layout the firmware image starts at 0x1f000. The bootloader starts at address 0x78000. So from my understanding the firmware exactly fits into the space between 0x1f000 and 0x78000. Correct me if I'm wrong. Do I miss something? Are there any restrictions regarding file size and DFU OTA update?

Best regards

Christian Haake

Parents
  • Hi,

    You are correct that the flash requirement of SoftDevice s132 version 3.0.0 (which is the one you use for generating the DFU zip with --sd-req 0x8c) is 124 kB (0x1F000 bytes). That means the application starts at 0x1F000.

    You are also correct that the bootloader (usually) starts at 0x78000.

    There are mainly two things that might reduce what size is possible for an application over DFU:

    1. Application data. This is non-volatile storage used by an application. As a huge oversimplification it can be compared to a desktop application storing files to disk. Application data is used for instance by peer manager (through FDS), and it is located next to the bootloader (at lower flash address than the bootloader. Usually two or three flash pages, which on the nRF52832 means address 0x7000 or 0x6b00. See the Infocenter section on Memory layout.
    2. Forcing dual bank update. Dual bank update means only free space in flash is used for downloading the new application. This means if anything goes wrong with the DFU you can still boot into the old application. (In contrast, with single bank you will end up in the DFU bootloader after an unsuccessful application update, and would have to do a successful DFU in order to get a working application after that.) By default the update is dual bank if enough space is available, but single bank is used as a fallback. Disabling single bank as a fallback requires changing a define in the bootloader source code and so this may be an issue only if you have done so. See also Dual-bank and single-bank updates.

    Regards,
    Terje

  • Hi ,

    2. I think this is not the case here since the application size forces a single bank update. 

    1. What if my application neither uses the application data region nor the peer manager? I mean 12kB (3 pages) is a lot of space one could use for "useful" things like e.g. code.

    On a quick look I found

    #define DFU_APP_DATA_RESERVED CODE_PAGE_SIZE*3
    in nrf_dfu_types.h

    Is this the line I would need to patch for the bootloader to flash from APP_IMAGE_START_ADDR to UICR_BOOTLOADER_START_ADDR?
    Can I somehow circumvent the bootloader from preserving this memory (without patching the bootloader code)?

Reply
  • Hi ,

    2. I think this is not the case here since the application size forces a single bank update. 

    1. What if my application neither uses the application data region nor the peer manager? I mean 12kB (3 pages) is a lot of space one could use for "useful" things like e.g. code.

    On a quick look I found

    #define DFU_APP_DATA_RESERVED CODE_PAGE_SIZE*3
    in nrf_dfu_types.h

    Is this the line I would need to patch for the bootloader to flash from APP_IMAGE_START_ADDR to UICR_BOOTLOADER_START_ADDR?
    Can I somehow circumvent the bootloader from preserving this memory (without patching the bootloader code)?

Children
Related