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

FDS GC error 0x06

I am using the FDS functions to save needed data to flash and retrieve it when needed. The init, writing, and reading all function correctly. However I am running into trouble with the garbage collection function.

When there is nothing written to flash the gc returns a value of 0 in the event handler. A value of 0 is FDS_SUCCESS if I correctly understand.

But if there is data written, gc returns a value of 0x06 in the event handler. According to fds.h (pasted below) that error is FDS_ERR_NO_OPEN_RECORDS. I am not sure why the gc function is returning with that error, I didn't think that was a valid error code for the gc function.

I have triple checked my code for any fds open calls that are not paired with a fds close call and do not have any.

I have also tested that when the gc returns with an error of 6, that the flash memory is not erased, as a memory full condition that exists before running gc still exists.

I would appreciate any help or suggestions.

nRF51822 chip, SDK 11.0, s130 v2.0.1

enum
{
    FDS_SUCCESS = NRF_SUCCESS,  //!< The operation completed successfully.
    FDS_ERR_OPERATION_TIMEOUT,  //!< Error. The operation timed out.
    FDS_ERR_NOT_INITIALIZED,    //!< Error. The module has not been initialized.
    FDS_ERR_UNALIGNED_ADDR,     //!< Error. The input data is not aligned to a word boundary.
    FDS_ERR_INVALID_ARG,        //!< Error. The parameter contains invalid data.
    FDS_ERR_NULL_ARG,           //!< Error. The parameter is NULL.
    FDS_ERR_NO_OPEN_RECORDS,    //!< Error. The record is not open, so it cannot be closed.
    FDS_ERR_NO_SPACE_IN_FLASH,  //!< Error. There is no space in flash memory.
    FDS_ERR_NO_SPACE_IN_QUEUES, //!< Error. There is no space in the internal queues.
    FDS_ERR_RECORD_TOO_LARGE,   //!< Error. The record exceeds the maximum allowed size.
    FDS_ERR_NOT_FOUND,          //!< Error. The record was not found.
    FDS_ERR_NO_PAGES,           //!< Error. No flash pages are available.
    FDS_ERR_USER_LIMIT_REACHED, //!< Error. The maximum number of users has been reached.
    FDS_ERR_CRC_CHECK_FAILED,   //!< Error. The CRC check failed.
    FDS_ERR_BUSY,               //!< Error. The underlying flash subsystem was busy.
    FDS_ERR_INTERNAL,           //!< Error. An internal error occurred.
};
Parents
  • Hi Kristin, Thanks for getting back to me. I have traced through the code and found where the error is actually coming from. Here is the call sequence: fds_gc -> queue_start -> queue_processing -> gc_execute -> gc_state_advance -> gc_next_page -> gc_record_find_next -> gc_page_erase -> fs_erase

    I am getting fs_erase returning error 6, which is FS_ERR_UNALIGNED_ADDR, but it gets propogated up the fds chain still as error 6 hence my confusion.

    I am starting to look into why our address is now unaligned. If you have any suggestions I would greatly appreciate it.

    One other note, this behavior seems to have started when we added the Peer Manager to our code.

    Thanks again

Reply
  • Hi Kristin, Thanks for getting back to me. I have traced through the code and found where the error is actually coming from. Here is the call sequence: fds_gc -> queue_start -> queue_processing -> gc_execute -> gc_state_advance -> gc_next_page -> gc_record_find_next -> gc_page_erase -> fs_erase

    I am getting fs_erase returning error 6, which is FS_ERR_UNALIGNED_ADDR, but it gets propogated up the fds chain still as error 6 hence my confusion.

    I am starting to look into why our address is now unaligned. If you have any suggestions I would greatly appreciate it.

    One other note, this behavior seems to have started when we added the Peer Manager to our code.

    Thanks again

Children
No Data
Related