Hello everyone!
We are using nRF51822 SoC together with s130 Softdevice. nRF5 SDK v12.3.0 is used for firmware development together with the Segger Embedded Studio.
Among the other things, we have a need to store one 32-bit variable in non-volatile flash memory. Consequently, we decided to use Flash Data Storage (FDS) for that purpose.
We can properly initialize the FDS module by using:
ret_code_t ret = fds_register(fds_evt_handler);
if (ret != FDS_SUCCESS)
{
// Registering of the event handler has failed.
}
ret_code_t ret = fds_init();
if (ret != FDS_SUCCESS)
{
// Handle error.
}
as it is described here.
However, the trouble comes when we want to write a record to the flash with the fds_record_write() function (link). The function returns FDS_SUCCESS which implies that the write record operation was queued successfully but we never get the FDS_EVT_WRITE event inside the event handler (fds_evt_handler()).
Do you have any idea what we are missing here? We are using FDS in combination with the Softdevice. Perhaps that can be an issue? Do we need any particular SES settings that will enable FDS storage?
Here attached you can find nvs_storage.c/h modules that contain FDS-related code. As you can see, when we call the init_nvs_storage() function for the very first time, there will be no record in the flash, and create_blank_ouid_records() function will be called. Within that function, we try to call fds_record_write() that returns FDS_SUCCESS but FDS_EVT_WRITE event is never detected inside the event handler (fds_evt_handler()).
Thanks in advance for your time and efforts. Looking forward to hearing from you.
Cheers!
Bojan.

