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

FDS update giving error 0x07

So I have been saving a structure using FDS and it seems to be working fine but after a while (2-3 hours of updating value every 10 seconds) the fds_record_update(); function starts to give error 0x07:

rc = fds_record_update(&desc, &record);
APP_ERROR_CHECK(rc);

What does this error pose the problem of? Let me know if you need more information. I am using SES with SDK 15.3.

Suggestions would be greatly appreciated.

  • Hi, 

    Error code 7 ('FDS_ERR_NO_SPACE_IN_FLASH') means that you have run out of flash. So you need to run garbage collection to free up space, see the "Garbage collection" section in FDS for more details. 

  • Thanks Vidar Berg.

    Also is there any link that can definitely tell me about the list of explanations of error codes for FDS, like e.g. 0x07 meant Invalid Parameter but you further explained it to be 'FDS_ERR_NO_SPACE_IN_FLASH'.

    That being said I want to clarify one more thing, that why is the garbage collection even needed, for a specific key doesn't the FDS rewrite in the same KEY record again and again? Or for a specific KEY it writes records in a space of memory while also retaining previous entries into the same KEY record?

    Further what would you recommend I should run the 

    fds_gc(void);

    function. Maybe just before each write or something?

  • FDS uses the same number range for errors as the SDK does, so the error codes can be a bit misleading. We changed the FDS error base in SDK 16.0.0 for that reason. 

    Ameer Usman said:
    That being said I want to clarify one more thing, that why is the garbage collection even needed, for a specific key doesn't the FDS rewrite in the same KEY record again and again?

    It's not possible to update existing data in Flash memory without erasing it first ( erase is required to flip a bit from '0' to '1'). And the smallest section you can erase is one flash page (4KB on 52 series). So FDS adds a new record and invalidates the previous one when you do an update. You will eventually have to run GC to delete all the invalidated records.

    Ameer Usman said:
    function. Maybe just before each write or something?

     You shouldn't run it too often because it may cause unnecessary wear on flash, and is also time-consuming (a page erase takes ~90 ms). You can use the fds_stat() function to determine when you should run it. Or you could just  wait until you get the FDS_ERR_NO_SPACE_IN_FLASH, then run GC. 

Related