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

FDS event FDS_EVT_WRITE not triggered when using SDK 16.0.0 and Softdevice S132 7.0.1

Trying to get FDS working with the latest SDK 16.0.0 and Softdevice S132 7.0.1. The problem is that FDS event handler triggers only when softdevice is disabled. Here is the snippet:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
volatile bool fdsInitialized;
void fdsEventHandler(fds_evt_t const *event) {
switch (event->id) {
case FDS_EVT_INIT:
if (event->result == NRF_SUCCESS) {
NRF_LOG_INFO("FDS initialized");
fdsInitialized = true;
}
break;
case FDS_EVT_WRITE:
if (event->result == NRF_SUCCESS) {
NRF_LOG_INFO("FDS write completed");
NRF_LOG_INFO("Record ID: 0x%04x", event->write.record_id);
NRF_LOG_INFO("File ID: 0x%04x", event->write.file_id);
NRF_LOG_INFO("Record key: 0x%04x", event->write.record_key);
}
break;
}
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I have FDS_VIRTUAL_PAGES set to 3 in my sdk_config.h. I erase the chip, flash the softdevice, then flash the application and see the following log output:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
<info> app: Started
<info> app: Waiting for FDS to be initialized
*** RESET ***
<info> app: Started
<info> app: Waiting for FDS to be initialized
*** RESET ***
<info> app: Started
<info> app: Waiting for FDS to be initialized
*** RESET ***
<info> app: Started
<info> app: FDS initialized
<info> app: Waiting for FDS to be initialized
<info> app: Wrote record ID: 1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

It seems that FDS initializes one page at a time. After 3 resets I get past FDS initialization and get NRF_SUCCESS code returned from fds_record_write function. However, FDS_EVT_WRITE is not triggered. If I disable softdevice, everything goes smoothly and I see the following output:

Fullscreen
1
2
3
4
5
6
7
8
<info> app: Started
<info> app: FDS initialized
<info> app: Waiting for FDS to be initialized
<info> app: FDS write completed
<info> app: Record ID: 0x0001
<info> app: File ID: 0x1111
<info> app: Record key: 0x2222
<info> app: Wrote record ID: 1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I've seen similar posts regarding SDK 14 with the same behavior but the solution there didn't work for me:

https://devzone.nordicsemi.com/f/nordic-q-a/32582/fds_evt_handler-not-invoked-for-52840-sdkv14-2-s140

https://devzone.nordicsemi.com/f/nordic-q-a/29089/nrf_fstorage_sd-not-receiving-soc-events

However, the missing nrf_sdh_soc.c which was the cause of the issue is already included in my target.