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.

Use EEPROM(Flash) for data retention in TMS320F2808 Microcontroller

Other Parts Discussed in Thread: TMS320F2808, CONTROLSUITE

Hi,

I am working on TMS320F2808 Microcontroller.I am facing some issues in retaining the data once the controller is reset. i need the data to be retained even after the reset.so i need to use the Flash as EEPROM.

Kindly help me in doing so.i am referring a application note from TI called EEPROM Emulation With the TMS320F28xxx DSCs.Is there any other documents or methods. 

Please let me know.

regards,

Sanath Rai

  • Hi Sanath,

    i am referring a application note from TI called EEPROM Emulation With the TMS320F28xxx DSCs.Is there any other documents or methods.

    That's the only doc available for this application. Did you try implementing the same?

    BTW I prefer using external EEPROM :)

    Regards,

    Gautam

  • Sanath,

    Most applications do not need actual EEPROM like capability (i.e., random access to multiple constants).  A simple scheme often works.  Suppose for example that you're just storing a few values at various times in your application.  It is easier to just read the old set of values, update the ones that need updating, and then store the entire new set back to memory.  People typically want to use two flash sectors for this.  They do not erase a sector every time a new set is written.  Rather, they just write the new set at the address that follows the old set.  When one sector fills up, they move to the second sector.  When the second sector fills up, they erase the first sector and move back to it.  See the picture?

    At power up, the code can do a search in those flash sectors to find the last used address.  Unused addresses will be all 0xFFFF (erased) so the search can seek as many successive 0xFFFF's in a row that it wants to convince itself that it has found the last used address.  The reason to search for more than one 0xFFFF in a row is in case 0xFFFF could occur as a value in the data set you are storing.  It takes a little bit of thought to get all this right, but I think you can get the picture.

    The flash API algorithms allow you to erase and write to flash.  They are located on the F2808 product page under 'Software':

    http://www.ti.com/product/tms320f2808

    Note that on F2808, you cannot erase or write to the flash while executing code from flash.  It is also typically very difficult if not impossible to keep your main application running in realtime when operating on the flash since the flash APIs are not interruptible.  This is all documented in the API user's guide.

    If you need to do extensive and constant erasing and writing to the flash, I'd agree with Gautum that it would be better to use an external EEPROM.  The flash on F2808 was not designed for this purpose.  You can get away with the occasional write to flash if your application tolerates it, but if you are routinely writing to flash it can be very intrusive to your application.

    Regards,

    David

  • Hello,

    There is an old thread about this: http://e2e.ti.com/support/microcontrollers/c2000/f/171/p/55179/263737.aspx#263737

    And in this thread, Lori gave the link to eeprom example (in zip file) that I think it can be used for F2808 because it also provides Flash2808_API_V302.lib.

    However, I have never used it or tried it, because I don't have the device.

    For example of EEPROM Emulation, I used example from C:\ti\controlSUITE\device_support\f2806x\v136\F2806x_examples_ccsv5\flash_programming, that maybe you can learn to follow the structure because the zip file example from the link is old and I don't know whether it can be compiled well in new CCS or not.

    You can try it and let us know. Hope you can find a way.

    Btw, I agree with Gautam about external EEPROM.

    Since we need to erase the FLASH (that the process can't be interrupted) before we write the FLASH, it is very critical if you want to update the values in the FLASH many times or often.

    Good luck.

    Best regards,

    Maria