Unable to write to specific area of flash shared by custom bootloader and BLE application

Hello Nordic Team,

I am working on an application which has custom bootloader and BLE application firmware. The bootloader code resides in flash area 0xE0000 - 0xEDFFF, application firmware code resides in 0x27000 - 0xDFFFF. There is some data that is used by both application and bootloader and this is placed in flash area 0xEE000 - 0xEFFFF. Data which is used only by application is placed in flash area 0xF0000 - 0xF5FFF. 

For writing to flash in bootloader, I am using nrf_nvmc_write_words() which works as there is no Softdevice running in bootloader. For writing to flash in BLE application firmware, I am using nrf_fstorage_write() with fstorage api pointing to nrf_fstorage_sd and wait until flash is not busy using this function: 

static void wait_for_flash_ready(nrf_fstorage_t const * p_fstorage)
{
    /* While fstorage is busy, sleep and wait for an event. */
    while (nrf_fstorage_is_busy(p_fstorage))
    {

    }
}

Writing to flash in application firmware works fine for flash area 0xF0000. However, when trying to write to area 0xEE000 from application, the program is stuck forever in wait_for_flash_ready(). Could you please let me know what could be the cause of this issue?

Regards,

Anusha

Related