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

SDK v14.1 fstorage couldn't write data

Hi

I add the fstorage to ble_app_uart on the SDK v14.1 to work on nRF52810. After fstorage initialization, I could write data to flash.

However, if I write the data received by UART to flash, it return no error while the value is the old value. That is to say, the data hasn't been written to flash. The maic.c is my code. Could anyone give me some advice? Thanks

main.c

Parents
  • Hi,

    The nrf_fstorage library is asynchronous, meaning that the data is written "in the background". You will get NRF_FSTORAGE_EVT_WRITE_RESULT event when the write operation have completed. In your code you have a call to nrf_fstorage_read() directly after call to nrf_fstorage_write(). You will have to wait for the write event before reading flash, to be sure you get the correct data.

    Best regards,

    Jørgen

Reply
  • Hi,

    The nrf_fstorage library is asynchronous, meaning that the data is written "in the background". You will get NRF_FSTORAGE_EVT_WRITE_RESULT event when the write operation have completed. In your code you have a call to nrf_fstorage_read() directly after call to nrf_fstorage_write(). You will have to wait for the write event before reading flash, to be sure you get the correct data.

    Best regards,

    Jørgen

Children
No Data
Related