This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Data storage option in CC3200 flash memory

Other Parts Discussed in Thread: CC3200

I want to store some variables in flash memory of CC3200. Currently I am doing it with .txt file format. I am completely unaware of this approach regarding life time of flash memory. How does this approach affect the life cycle of flash memory?? Is there any other file extension can be used to store variable rather .txt?

Is it possible to develop an key-value kind of algorithm with CC3200 flash memory?? In brief, one dedicated key is defined for variable and variable is modify (read, write) using that key (kind of shared preferences in android).

It would be highly appreciated if one can share some idea ,technique or algorithm for storing variables in CC3200 flash??

  • Hi Niral,

    I am using the Flash to store configuration information and "scenes".  I do not think you need to worry about how many cycles serial flash can take, according to Barak from TI, it will be around 100,000 - http://e2e.ti.com/support/wireless_connectivity/f/968/p/353080/1239840.aspx#1239840

    The extension used is unlikely to matter, as your program will just read the file....unless you have coded to take the extension into account.

    The way I do it, is that I store all my data as a number of different JSON files, I can then read and extract the data I want, and when I want to save the data, I create my JSON string and then save by over writing the old file. This may be more work than is required for your situation, but it is useful when you are dealing with lots of variables that change over time, and you use the JSON to control your device.

    A simple comma separated file may suffice for your needs, you could even create 1 file for each variable, the file name would be the variable name, while the contents would be the value. Keep in mind you have a maximum of 127 files on the flash, so this method will only work if you do not have a lot of variables to work with.

    Glenn.

  • Thanks Glenn for all information..

    Can you tell me how to begin with JSON..?? I have never worked with JSON. How convenient is it as compared to .txt.?

  • JSON is great once you have set everything up in your code, because then you can parse it and get the key/value pairs you want easily. But it is a fair bit of work to set this up on an embedded system, there are libraries available to help out, I used JSMN, which you can find here - http://zserge.com/jsmn.html  - The library also provides an example test suite, so you can use this to work out how to develop your own code.

    This library is not as nice as the ones I have used in desktop or mobile technologies, as you do need to do extra work during the parsing to "collect" your results. But it is distributed under the MIT license, which means you can use in proprietary projects without any issues.  There may be more advanced libraries for embedded systems out there.

    Unless you have a lot of variables, then this may be more work than it is worth. And if unfamiliar with JSON, then I recommend you do a lot of reading up on it, the Internet has many resources to help out with this.

    Oh by the way, JSON is  TXT (text)...it is just formatted in a particular way...just as CSV (comma separated) is also text. 

    Glenn.

  • @Glenn

    Thank you very much for sharing. 

  • @Glenn,

    Should these json files be saved at the html folder of the CCS project?

    - kel

  • Hi Kel,

    These JSON files are only internal to my application, I create them with code using variables and then store them on the serial flash using the Fs API/Module.

    Glenn.

  • Glenn Vassallo said:
    These JSON files are only internal to my application, I create them with code using variables and then store them on the serial flash using the Fs API/Module.

    I am still learning how to do that. I am trying to do something like this below. What do you think is the best approach to do a similar application like this below.

    http://wiki.openpicus.com/index.php/A_Fridge_Alarm

    I am thinking I can do a similar application using the httpserver example program as reference. But, I think the httpserver does not use JSON files to set device configuration. I can't find any JSON files anywhere at the folders of httpserver example program.

    - kel

  • Kel,

    The file_operations example is the one you need to look at. A JSON file is just a text file, that is formatted in a certain way. You don't need to use JSON, in fact that may be too much work for what you have in mind, as you will need to parse the JSON file to extract the data. It is likely easier if you use a comma delimited file format or some other mechanism.

    As for using the httpserver_example, I do not see any need to do it this way, unless you want to alter the variables using a web form. It would be much easier to just set the values for your variables inside your application code, or just have a string with the values that you then write and read from the serial flash.

    Glenn.

     

  • Hello Glenn,

    I am  working with the CC3200 Simplelink device, and have read a lot of your posts and answers.

    Hope you help me on this one.

    I have been referring to the httpserver code, wherein i have been able create my own webpage for setting the IP address, gateway etc.

    I have used user-defined tokens and successfully received data in my code.

    My problem is that i am unable to save this data in a file on the Serial Flash.

    I want to save the data in a .txt file, but the command lRetVal = sl_FsOpen((unsigned char *)USER_FILE_NAME, FS_MODE_OPEN_CREATE(65536, \ _FS_FILE_OPEN_FLAG_COMMIT|_FS_FILE_PUBLIC_WRITE), ulToken, lFileHandle); does not execute completely, and does not return lRetVal.

    I did refer to the file_operations code, and performed these open-read-write operations successfully.

    But, i am unable to do the same in httpserver code.

    Please shed some light on this.