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

Dfu Single Bank Bootloader Settings not Saving after DFU

Hi,

I am trying to get the dfu single bank bootloader (github.com/.../nrf51-dfu-single-bank-ble) supplied by Nordic to work. I can successfully push firmware to my device using Android MCP, and can get my application to load by calling bootloader_app_start(DFU_BANK_0_REGION_START);.

The trouble I am having is the bootloader_app_is_valid(DFU_BANK_0_REGION_START) function will not verify that the pushed firmware is valid. After some digging it seems that the bootloader_settings_save(&settings) function is failing to change the bootloader settings in flash after DFU_UPDATE_COMPLETE has been set. Looking at the internals of bootloader_settings_save() it looks like the pstorage_clear() followed by pstorage_store() function calls are not changing the flash memory, which is why bootloader_app_is_valid() returns false.

One thing to note is the pstorage_callback_handler() registered in bootloader.c does seem to be working because I can catch the update status changing to BOOTLOADER_COMPLETE.

Details about my setup: -Custom Hardware using nrf51822 chip -Using Eclipse GCC IDE -SDK 6.1 -SoftDevice S110_nRF51822_7.2

Any help is much appreciated. Thanks

Parents
  • Instead of using the example on GitHub, which is based on SKD v6 and has not been maintained for some time, I recommend using SDK v9.0 and S110 v8.0.

    You can convert the S110 Dual Bank Bootloader to a Single Bank Bootloader by replacing only one file, dfu_dual_bank.c with dfu_single_bank.c.

    Attachments:

    DualToSingleBank.pdf

    nRF51_SDK_v9_0.zip

    -Bjørn

  • Hi Bjorn, I switched to SDK v9.0 S110 v8.0 and dfu_single_bank.c and still have trouble getting single bank to work. In dfu_init() the pstorage_register(&storage_module_param,&m_storage_handle_app) call returns error 7, which is block_size or block_count error. The problem is I can't find anywhere that the block size is set for storage_module_param. Do I have to set that? Another error from dfu_prepare_func_app_erase() if my image size is 71492 bytes then the block_size needs to be 2 because image size could change later and image_size somehow has to always be divisible by block_size, since block_size is defined in the bootloader? Does DFU somehow pad the image size so it will be a multiple of block_size? Thanks.

Reply
  • Hi Bjorn, I switched to SDK v9.0 S110 v8.0 and dfu_single_bank.c and still have trouble getting single bank to work. In dfu_init() the pstorage_register(&storage_module_param,&m_storage_handle_app) call returns error 7, which is block_size or block_count error. The problem is I can't find anywhere that the block size is set for storage_module_param. Do I have to set that? Another error from dfu_prepare_func_app_erase() if my image size is 71492 bytes then the block_size needs to be 2 because image size could change later and image_size somehow has to always be divisible by block_size, since block_size is defined in the bootloader? Does DFU somehow pad the image size so it will be a multiple of block_size? Thanks.

Children
No Data
Related