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

nRF Toolbox DFU suddenly fails with Error 4 - Insufficient resources

Hi there,

We've been doing OTA DFU updates for a while now, but a recent increase (by one page = 4kb) of the firmware has created an issue.

Flashing through USB serial works fine, but the same firmware can't be pushed with nRF Toolbox DFU via Bluetooth anymore. When trying to do so, it almost immediately generates an Error 4 - Insufficient resources.

Given the error, I can only imagine that the device runs out of flash memory. This new version of our firmware is slightly bigger than previous versions. Once flashed through USB serial along with the Bootloader and the SoftDevice, there is only one page of flash memory left available. But it is immediately used by the firmware for fstorage when it first runs.

I couldn't find a definitive answer but I'm thinking that the DFU settings backup feature needs one free page of flash memory, and because it fails do so the update is aborted.

I would like to know if my assumptions are correct or if the OTA DFU might fail for another reason.

Thanks a lot!

Parents
  • Hi,

    Insufficient resources (NRF_DFU_RES_CODE_INSUFFICIENT_RESOURCES) happens if: 

    - nrf_dfu_cache_prepare() cannot find room for the update (what you are assuming)

    - If trying to push a bootloader update that is too large to fit the bootloader slot (BOOTLOADER_SIZE).

    - If the init command is too big (INIT_COMMAND_MAX_SIZE)

    - If the protocol attempts to create an object that is too big (failure of the DFU protocol)

    We assume it is the first one. OTA DFU is using dual bank, while flashing over USB does not,that may be why you only see it in DFU. There is a difference in when dual bank is used, you can look in nrf_dfu_cache_prepare() to see the details about calculation of the bank size.

  • Thank you so much!

    This was very helpful and lead me to understand the issue. Our Bootloader code defines NRF_DFU_APP_DATA_AREA_SIZE which was set to 8192. However because the firmware increased size, there is only 4096 bytes left for the application data now. Changing the value to 4k fixed the OTA DFU issue.

Reply Children
No Data
Related