fds_gc() garbage collect always causes a reset

Using SDK 17.1.0, SD s140_nrf52_7.2.0

I have FDS working - I can read/write records.  I am using it to store ongoing logs.

When I get to a FDS_ERR_NO_SPACE_IN_FLASH, I delete a certain number of records to make room.  Then call fds_gc().

fds_gc() always causes a reset.  After reset however, it seems to have done the needful, I have the expected amount of flash available again, and I can continue writing records until I hit a NO_SPACE error again.

Any ideas on what to do here ?

Thanks - Daraius

  • I have now verified that if I use FDS in the exact same sequence from main() without FreeRTOS it works fine.  

    I have it using only 4 pages.  I am writing about 300 records.  Then when a fds_record_write() returns FDS_NO_SPACE_IN_FLASH, I delete the oldest 100 records, and then run fds_gc()

    Doing the exact same thing from a single FreeRTOS thread crashes every time. Same crash as shown above.

    Its the only thread, its the only thing the thread is doing.

    	PF2_fds_Init();
    	while(true)
    	{
    		PF2_fds_FillLogPackets();
    		nrf_delay_ms(500);
    		
    		vTaskDelayUntil(&xLastExecutionTime, Convert_ms_to_Ticks(APP_TASK_RATE_MS));  
    	}

    I have seen a few other posts about FDS problems with FreeRTOS.  No solutions really.

    Any help appreciated.  Thanks

  • Hi,

    It seems to be correct that queue_process() operate recursively to delete all the freeable records. Can you try to reduce the number of deleted records in one garbage collection run, or increase the stack size even further?

    It might be possible to rewrite the FDS library to not run the queue_process() operation recursively, but this would require changes to the FDS implementation.

    Best regards,
    Jørgen

  • I ended up rewriting all my stuff using fstorage, and its working fine so far.
    My logging is linear, just periodic timestamped records.  So I am just using the allocated flash pages in circular fashion.

Related