Softdevice S112 Flash Write Hangs Indefinitely

Hi all,

Within my application I've followed the example/fstorage to the letter however upon requesting a flash write to the s112 the nrf_fstorage_is_busy() function loops indefinitely.


The flash page has been sectioned off in the XML.

<ProgramSection alignment="4" keep="Yes" load="No" name=".settingsStore" address_symbol="__start_main_settings_page" end_symbol="__stop_main_settings_page" start = "0x0002F000" size="0x1000" />

And is also referenced as a const in c. the confgProto is about 200 bytes, much less than the page size.

static const struct configProto storedConfig __attribute__((section(".settingsStore"))); // reserve flash page

I'm pretty sure these are working fine. The page comes up in the final build at the end of the device space and the values are set as I'd expect.

So then, the flash write. First of all the Softdevice is working great, data back and forth without issues. The command to flash is issued by the BLE device and it sends nothing else until a return notification is received. There's only ever the one device attached (it stops advertising) so after sending the command to flash there's no chatter other than whatever the softdevice has to do internally.

Here's the main bits of the flash code ripped from the code.

   NRF_FSTORAGE_DEF(nrf_fstorage_t fstorage) =
    /* Set a handler for fstorage events. */
    .evt_handler = fstorage_evt_handler,

    /* These below are the boundaries of the flash space assigned to this instance of fstorage.
     * You must set these manually, even at runtime, before nrf_fstorage_init() is called.
     * The function nrf5_flash_end_addr_get() can be used to retrieve the last address on the
     * last page of flash available to write data. */
    .start_addr = 0x2F000,
    .end_addr   = 0x30000,

ret_code_t rc = nrf_fstorage_init(&fstorage, &nrf_fstorage_sd, NULL);
   ret_code_t rc = nrf_fstorage_write(&fstorage, 0x2F000, &config, sizeof(config), NULL);

    NRF_LOG_INFO("Config write.");

There is no logging in the fstorage_evt_handler() function, so it isn't being called. I don't know how many times that's expected to be called for wiping a single page of flash but it could be an indicator.

I know it's stuck waiting due to.

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)) {

Any ideas?