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

p_stat.valid_records not increasing though fds_write gives success

Hello,

I am using sdk 12.2.2 and nrf52 customised development board. My challenge is as follows.

1) I am getting success in fds'_write function.

ret_code_t ret = fds_record_write(&record_desc, &record);
if (ret != FDS_SUCCESS)
{
if(ret == FDS_ERR_NO_SPACE_IN_FLASH)
{
NRF_LOG_INFO("full\r\n");
gc_running = 1;
ret = fds_gc();
while(gc_running);
NRF_LOG_INFO("gc\r\n");
}
sf_print_fds_stat();
fds_record_write(&record_desc, &record);\

2) When I am calling below function

static void sf_print_fds_stat()
{
    fds_stat_t p_stat;
    fds_stat(&p_stat);
	  if (p_stat.valid_records >= 10000)
    {
			 delete_flag = 0;
       fds_file_delete(DATA_INFO);
       fds_file_delete(CURRENT_INFO);
			 while(record_flag == 0);
       for(CurrentFileId=FILE_ID;CurrentFileId>=FDS_DATA;CurrentFileId--)
       { 
				delete_flag = 0;
        fds_file_delete(CurrentFileId);
				while(record_flag == 0);
       }
       FILE_ID   =  FDS_DATA;
       iTotalRecord   =  1;
       Save_Id = DATA_INFO;
       Save_Key = STD_REC_KEY;
       Setting_ID = CURRENT_INFO;
       Setting_KEY = STD_REC_KEY;
       iIndex = 0;
       fds_gc();
		}
    NRF_LOG_INFO("open_records   : %d\r\n", p_stat.open_records);
    NRF_LOG_INFO("valid_records:    %d\r\n", p_stat.valid_records);
    NRF_LOG_INFO("dirty_records:    %d\r\n", p_stat.dirty_records);
    NRF_LOG_INFO("words_reserved: %d\r\n", p_stat.words_reserved);
    NRF_LOG_INFO("words_used      : %d\r\n", p_stat.words_used);
    NRF_LOG_INFO("largest_contig   : %d\r\n", p_stat.largest_contig);
    NRF_LOG_INFO("freeable_words  : %d\r\n", p_stat.freeable_words);
}

In p_stat.valid_records my valid records are not increasing after 4846. You can find the details in log file after line number 125938.

Please help me to solve this challenge.

I am also attaching log file for same.

Thanks,

040818.txt

Related