- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What APIs should I use to store non-volatile data?
I am using cyw43907 and the manual says it supports External Flash Memory.
I wonder if I should use wiced_sflash_write to store the data, or whether I can save it using wiced_dct_write.
Solved! Go to Solution.
- Labels:
-
ispn:36623:1:0
-
l1:3966:1:0
-
l2:6066:1:0
- Tags:
- sflash
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can use wiced_dct_write() to store data during runtime in DCT section of flash. The string_var in the example is modified during runtime. The dct_read_write_app_dct_t struct in the example is user defined. Similarly you can have your own struct or you can simply store other data types in DCT dynamically. Using API to directly write to SFlash is not recommended because the SFlash has a well defined memory layout and if you write data into a dedicated section (such as bootloader), you may risk corrupting that section.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can use DCT app section so that the data persists across power cycles. Please refer to snip.dct_read_write to check how the App section is modified.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, I saw the snip.dct_read_write project.
But the example seems to have to use dct predefined(like my_app_dct_t
structure), right?
What I want to do is dynamically save and store data in flash.
Can I use sflash_read/write API?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can use wiced_dct_write() to store data during runtime in DCT section of flash. The string_var in the example is modified during runtime. The dct_read_write_app_dct_t struct in the example is user defined. Similarly you can have your own struct or you can simply store other data types in DCT dynamically. Using API to directly write to SFlash is not recommended because the SFlash has a well defined memory layout and if you write data into a dedicated section (such as bootloader), you may risk corrupting that section.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oh, I see. Thank you for answer
If so, which API should I use if I want to delete all the data in the flash's DCT_APP_SECTION?
There is only read/write in the dct API.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can set the value of each member of the structure to 0 and write this in DCT. This should be done between wiced_dct_read_lock() and wiced_dct_read_unlock().