I am trying to use the fstorage library to store some data for my application and use the flash_fstorage example in SDK16 as a starting point and copied the required codes to my application.
I have to following array declared and called the nrf_fstorage_write function:
static char rx_data[] = "12345678901"; rc = nrf_fstorage_write(&fstorage, 0x3e000, rx_data, sizeof(rx_data), NULL); APP_ERROR_CHECK(rc); wait_for_flash_ready(&fstorage); NRF_LOG_INFO("Done.");
This works well. There is 11 bytes in the array but I am not sure why the log gives:
--> Event received: wrote 12 bytes at address 0x3E000.
If I change rx_data[] to a larger size, eg static char rx_data[] = "123456789012", it gives the following error:
<error> nrf_fstorage: !(len % p_fs->p_flash_info->program_unit) check failed in nrf_fstorage_write() with value 0x9.
<error> app: ERROR 9 [NRF_ERROR_INVALID_LENGTH] at D:\Nordic\nRF5_SDK_16.0.0\examples\ble_peripheral\ble_app_uart\main.c:1238
PC at: 0x000316AD
Anyone can advise? Thanks in advance.