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

nrf_fstorage_sd when Softdevice is disabled

Hi I am looking at using nrf_fstorage_sd when the softdevice is present but disabled. 

What happens when you call nrf_fstorage_sd with respect to call backs and events? I assume that you do not get an event from the softdevice because it is not running? Do you just assume that the flash has been written? Would this be blocking when the softdevice isnt enabled? 

Parents
  • Hi,

    nrf_fstorage_sd can be used anytime the SoftDevice is present, regardless of its status (enabled/disabled). For more info see this link.

  • OK I have read the documentation and it is not clear on what happens when the Softdevice is present but not enabled and I write to flash.

    1) Should I get call backs/ Softdevice system events?

    2)If I should get a system event then who do I need to set the Softdeivce up to get them. (Register for system events?) 

  • 1) Should I get call backs/ Softdevice system events?

    Yes, you will get the SoC events NRF_EVT_FLASH_OPERATION_SUCCESS and NRF_EVT_FLASH_OPERATION_ERROR from the fstorage library even when the SoftDevice is disabled.

    2)If I should get a system event then who do I need to set the Softdeivce up to get them. (Register for system events?) 

    The fstorage library handles this for you, in nrf_fstorage_sd.c you can see the event handler, nrf_fstorage_sys_evt_handler(), and how it's registered:

    /* Define a nrf_sdh_soc event observer to receive SoftDevice system events. */
    NRF_SDH_SOC_OBSERVER(m_sys_obs, 0, nrf_fstorage_sys_evt_handler, NULL);

    If you want to test it out, take a look at the flash_fstorage example in the folder SDK_folder\examples\peripheral\flash_fstorage

  • nrf_fstorage_sd.c

    case NRF_SUCCESS:
            {
                /* The operation was accepted by the SoftDevice.
                 * If the SoftDevice is enabled, wait for a system event. Otherwise,
                 * the SoftDevice call is synchronous and will not send an event so we simulate it. */
                if (!m_flags.sd_enabled)
                {
                    nrf_fstorage_sys_evt_handler(NRF_EVT_FLASH_OPERATION_SUCCESS, NULL);
                }
            } break;

    So you will get a call back from the Nordic driver but you wont from the soft device. 

Reply
  • nrf_fstorage_sd.c

    case NRF_SUCCESS:
            {
                /* The operation was accepted by the SoftDevice.
                 * If the SoftDevice is enabled, wait for a system event. Otherwise,
                 * the SoftDevice call is synchronous and will not send an event so we simulate it. */
                if (!m_flags.sd_enabled)
                {
                    nrf_fstorage_sys_evt_handler(NRF_EVT_FLASH_OPERATION_SUCCESS, NULL);
                }
            } break;

    So you will get a call back from the Nordic driver but you wont from the soft device. 

Children
No Data
Related