Hello,
nRF52840, SDk16.0, Softdevice 7.0.1,
I am having the following flash write error message while writing data to flash. I'm using FDS library. Interestingly this happens only on a particular hardware. There are other boards with same chipset and we used same code for over a year and they never gave such error. We fear that this issue may arise in product units as we are just about to launch the product.
Googling shows that I'm trying to write data into wrong memory area, but FDS lib doesn't allow you to choose memory addresses, there is file ID and file Key though mentioned at the end below.
Any idea what is happening.
Error message:
00> <info> app: Updating Script Record... 00> <info> app: Copied/dummy string 00> <info> app: 55 0A 00 00 01 58 1D 00|U....X.. 00> <info> app: 00 02 26 2F 00 00 03 00|..&/.... 00> <info> app: 01 05 00 63 FF E1 00 00|...c.... 00> <info> app: 00 00 00 00 00 00 00 00|........ 00> <info> app: 00 00 00 00 00 00 00 00|........ 00> <info> app: 00 00 00 00 00 00 00 00|........ 00> <info> app: 00 00 00 00 00 00 00 00|........ 00> <info> app: 00 00 00 00 00 00 00 00|........ 00> <info> app: 00 00 00 00 00 00 00 00|........ 00> <info> app: 00 00 00 00 00 00 00 00|........ 00> <info> app: Copied/dummy string len: 22 00> <info> app: Script record found 00> <error> nrf_fstorage: addr_is_within_bounds(p_fs, dest, len) check failed in nrf_fstorage_write() with value 0x10.
Code snippet where this happens:
void record_update_scr(char script[], int len){ ret_code_t rc; fds_record_desc_t desc = {0}; fds_find_token_t tok = {0}; //script_total_length = len; NRF_LOG_INFO("Updating Script Record..."); // NRF_LOG_INFO("Received string"); // NRF_LOG_HEXDUMP_INFO(script, sizeof(scr_dummy_cfg.script)); //script_id = script[len-1]; //NRF_LOG_INFO("Script ID: %d", script_id); // copy data into scr_dummy_cfg //int len = sizeof(scr_dummy_cfg.script); int i=0; for (i=0; i<len; i++){ scr_dummy_cfg.script[i] = script[i]; } for (i=len; i<scr_dummy_record.data.length_words*4; i++){ scr_dummy_cfg.script[i] = 0; } NRF_LOG_INFO("Copied/dummy string"); NRF_LOG_HEXDUMP_INFO(scr_dummy_cfg.script, sizeof(scr_dummy_cfg.script)); NRF_LOG_INFO("Copied/dummy string len: %d", len); //strlen(scr_dummy_cfg.script)) //NRF_LOG_INFO("Record len: %d", scr_dummy_record.data.length_words); wait_for_fds_ready(); rc = fds_record_find(SCR_FILE_ID, SCR_REC_KEY, &desc, &tok); if (rc == FDS_SUCCESS){ // RGB record found NRF_LOG_INFO("Script record found"); rc = fds_record_update(&desc, &scr_dummy_record); APP_ERROR_CHECK(rc); if (rc == FDS_SUCCESS){ NRF_LOG_INFO("Script record updated"); NRF_LOG_INFO("Script record id: %d", desc.record_id); } } else{ // System config not found; write a new one. NRF_LOG_INFO("Creating new Script file..."); rc = fds_record_write(&desc, &scr_dummy_record); APP_ERROR_CHECK(rc); } }
#define SCR_FILE_ID (0xF010) #define SCR_REC_KEY (0x7010)