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

Using Flash Data Storage to write Flash, turning BLE on results in FDS_ERR_BUSY in the flash write handler

Using SDK nrf52_sdk_16.0.0
PCA10040 S132

My code can read and write Flash using the "Data Storage Flash" interface, IE calling  fds_record_write(...)  and waiting for events in my callback with no issue.

WHen I added BLE advertising using the example  nrf52_sdk_16.0.0\examples\ble_peripheral\ble_app_beacon   with no modifications i cant write to flash I get an FDS_ERR_BUSY in my callback.

I tried turning off ble adverting by calling sd_ble_gap_adv_stop(...)  but this doesnt seem to fix it.

What am I missing here ?

  • Do you enable the SoftDevice after initializing the FDS? If so, could you try to switch it, and see if the problem is still present? First enable the SoftDevice then initialize the FDS library, as suggested here.

    If that doesn't work, could you upload your project and I'll take a look at it?

    Best regards,

    Simon

  • Hi Simon

    I will need to do some more checking and testing I am fairly new to Nordic and its not clear to me when  the SoftDevice is enabled, I thought it was enabled for FDS ?

    In my current code I am Initializing FDS, then writing to it successfully and then I turn on BLE for 1 minute and then I make the 2nd FDS write which fails.

    Below is the order of calls I make for BLE without all the details, based on what you have said I think I need to be possibly calling  nrf_sdh_enable_request()  before I initialize the FDS or setup all of my BLE but dont start the advertising. 

    I will loom at this and if i am still stuck will upload the code for you to look at .

    This is the order of calls I make to start BLE comes from the Beacon example.

    err_code = nrf_sdh_enable_request();

    err_code = nrf_sdh_ble_default_cfg_set(APP_BLE_CONN_CFG_TAG, &ram_start);

    err_code = nrf_sdh_ble_enable(&ram_start);

    err_code = ble_advdata_encode(&advdata, m_adv_data.adv_data.p_data, &m_adv_data.adv_data.len);

    err_code = sd_ble_gap_adv_set_configure(&m_adv_handle, &m_adv_data, &m_adv_params);

    err_code = sd_ble_gap_adv_start(m_adv_handle, APP_BLE_CONN_CFG_TAG);

    err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING);

    Then I call below to stop BLE
    err_code = sd_ble_gap_adv_stop(m_adv_handle);

  • Hi Simon

    Enabling the Softdevice before initializing the FDS solved the problem.

    Thanks Robin

Related