Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

I have a question about NFC_writable_NDEF.

Hi, I want to NFC connection. so I'm trying to NFC examples.

But, while i was testing NFC_writable_ndef_msg example I have some trouble.

Following the example, I succeeded in overwriting using NFC Tools App. After that, the original code contents were re-executed and still overwritten records remained.

I thought the overwritten record was in the flash data storage, so I deleted all records using the fds example.

And then, Flasing the Writable example again. after that I again flash the Writable example, but there are still overwritten records. Did I not understand?

Where are the Overwritten Records stored?
When I flash the Original code, I want to delete the Overwritten record.

Thanks.

Parents
  • Hi,

    Yes, the nfc_writable_ndef_msg example uses FDS to write records to flash.

    FDS updates records by writing the new (updated) record to flash and set a flag on the previous record in flash in order to invalidate it. This means if you look at flash directly you will see that all the records are still there, but if you search for them through FDS you will find only the record which is currently valid.

    Reprogramming the application on the board will not rewrite stored data, it will only rewrite the application. So that means if you only reprogram the application then you will still have the updated record from the "previous" run. To delete the FDS records when you reprogram you should do a full erase of the flash before programming. You can do that for instance with nrfjprog -e.

    Regards,
    Terje

  • thanks your answer, tesc.

    So, when I want to delete FDS records, If I have some data in FDS, All of this is deleted. right?

    I want to create a program that deletes the written data by finishing after the schedule process, but is it impossible to erase all the data in FDS?

  • I was under the impression that you wanted to program the nRF with new firmware, and at the same time erase any old application data stored with FDS.

    Now it sounds like you want to delete FDS records from the firmware itself? I will now describe how this works from application firmware.

    From FDS point of view the data is deleted when you use fds_record_delete(). I.e. you can not find it using fds_record_find() or find it any other way through the FDS API.

    Technically, what happens is that the record is invalidated (so that it will not be found when searching for records), so if you read flash directly (for instance using a programmer) you will see that the flash page is not actually deleted yet.

    The same thing happens on fds_record_update(). The "old" value is invalidated and a new record is written with the new value.

    This means more and more space is used for records. When you get little space left you do garbage collection with fds_gc(). After garbage collection you are left with only valid records, and the rest of the FDS flash space is erased.

    If you need to delete all records from the application firmware then you can for instance iterate through all records using fds_record_iterate() and then delete them one at a time. Or, if you know what file IDs you have been using, you can delete the files using fds_file_delete().

    Regards,
    Terje

  • Thanks Terje.

    Your answer has been a great help to me.

    Thanks again :)

Reply Children
No Data
Related