fstorage problem when update firmware OTA

Hi, in my project I'm using fstorage library to store some information that should be kept even after the firmware update.

For this we are reserving the memory address as shown below:

NRF_FSTORAGE_DEF(nrf_fstorage_t fstorage) =
{
    .evt_handler = fstorage_evt_handler,

    .start_addr = 0x6F000,
    .end_addr   = 0x6FFFF,
};

This code was working great, but it started losing memory after an update.

What could be happening? Is it possible for this starting address to be different?

Parents
  • You need to take into account that the OTA bootloader takes the upper flash memory and below it there are a couple of pages used by the FDS depends on how your project is configured (FDS_VIRTUAL_PAGES). Make sure you are not overriding those.

    For me it was best to use the provided function that calculates the flash address at run time. Use FDS_VIRTUAL_PAGES_RESERVED to define how much space you need and then use this in your flash init code as shown in the fds example:

    fstorage.end_addr = nrf5_flash_end_addr_get();
    fstorage.start_addr = fstorage.end_addr - (FDS_VIRTUAL_PAGES_RESERVED * FDS_VIRTUAL_PAGE_SIZE * sizeof(uint32_t));

Reply
  • You need to take into account that the OTA bootloader takes the upper flash memory and below it there are a couple of pages used by the FDS depends on how your project is configured (FDS_VIRTUAL_PAGES). Make sure you are not overriding those.

    For me it was best to use the provided function that calculates the flash address at run time. Use FDS_VIRTUAL_PAGES_RESERVED to define how much space you need and then use this in your flash init code as shown in the fds example:

    fstorage.end_addr = nrf5_flash_end_addr_get();
    fstorage.start_addr = fstorage.end_addr - (FDS_VIRTUAL_PAGES_RESERVED * FDS_VIRTUAL_PAGE_SIZE * sizeof(uint32_t));

Children
No Data
Related