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.

Runtime Flash Read/Write Capabilities on C2000 Launchpad TMS320F2802x

Other Parts Discussed in Thread: CONTROLSUITE, TMS320F28027

Hi Everyone,

This is my first post on TI community and i hope i wont disappoint anyone or i wont get myself disappointed :)

So i am reasonably well versed with STM32F4 family of microcontrollers and i know that it offers a way where we can program the on chip flash to read or write data using some FLASH API's and manipulating linker file.

But now i have a task in hand where i need to do something similar kind of task using C2000 Launhpad board housing TMS320F2802x controller.

I searched through online and in some TI documentations provided in the link below. None of them gave me any hints where i can use flash memory sectors to define my own data section and use it for Read/Write purpose during the runtime. I mean to say i need the some data generated in the program to get stored or fetched from the flash during runtime.

Please let me know if this is doable on this particular family of controller and launchpad or is not possible  ?? If not please provide me some alternatives !!

If doable please provide me some links and code examples on how i could achieve this ?

http://www.ti.com/lit/ug/sprufn6a/sprufn6a.pdf

Thanks! 

  • Preetham,

    Do you have Controlsuite installed? If yes, you can find F2802x Flash programming example at C:\ti\controlSUITE\libs\utilities\flash_api\2802x\v201a.

    Flash API reference guide is available at C:\ti\controlSUITE\libs\utilities\flash_api\2802x\v201a\doc.

    Is this what you are looking for?

    Thanks and regards,
    Vamsi
  • Hi Vamsi,

    Thank you for responding quick ...

    I have not looked in to this example yet, but does this example help me define a sector of data through linker script and can i read or write to the falsh during runtime ??
  • Hi Preetham,

    You've flash based linker file with the project ie .cmd file that you can very well edit. You can understand more about linking by referring to this wiki article:
    processors.wiki.ti.com/.../C28x_Compiler_-_Understanding_Linking

    Regards,
    Gautam
  • Preetham,

    Adding to what Gautam said:
    Checkout the example. It declares an array "Buffer" (this array will be in RAM) and initializes it with data (that we want to program in to Flash). Address of this Buffer is then passed as a parameter to the Flash_Program function which programs the data (in Buffer) in to the Flash. Once the data is programmed, the programmed contents are verified by reading the Flash (done by Flash_Verify() function).

    Checkout the linker command file Example_Flash28027_SW_API.cmd available at C:\ti\controlSUITE\libs\utilities\flash_api\2802x\v201a\example_ccsv5. Notice that the Flash API is mapped to one of the Flash sectors in the linker command file. Flash API is copied from Flash to RAM at runtime using the Example_MemCopy() function before performing the erase and program operations. Sector in which Flash API gets loaded is not erased in the example. Data is programmed in to the sectors to which Flash API is not mapped.

    Thanks and regards,
    Vamsi
  • Thanks Vamsi and Gautam for your valuable help...

    But what i still find difficult to understand is, if i can try to use the internal flash of an TMS320F28027 to store a bunch of user settable bytes that remain after rebooting.

    Or is FLASH API only used for first time reboot ?? In this case i am in a belief that FLASH API could be used for storing some user settable bytes in the flash and that be read or written during the main program execution....

    Can you guys please give me a clarity on this matter....!!!
  • Preetham,

    On-chip Flash in F2802x devices is a non-volatile memory.

    You can program data in to the Flash memory at run time (during the program execution) using the Flash API and this data will be available after power cycling (reboot) as well.

    You might also want to take a look at the EEPROM emulation guide @ www.ti.com/.../sprab69.pdf. This application report (and the associated example code given in this report) helps to define one sector of onboard Flash memory as the emulated electrically erasable programmable read-only memory (EEPROM) which can be transparently used by the application program for writing, reading and modifying the data.

    I would suggest you to first go through the API usage example in Controlsuite that we discussed earlier and try it for yourself.

    Thanks and regards,
    Vamsi
  • Thanks Vamsi,

    I have an issue though...

    So i am using the example that you suggested me on the control suit. This is for the API functionality.

    But when i opened the example as a new project compiled and tried to debug.... the program is not hitting the main() function at all in the debug preview....

    Could you please help me how i could start this program and debug .....and it would be really helpful if you could tell me which .cmd file should i use .....
  • Preetham,

    When the emulator is connected, the 2802x devices use the EMU_KEY and EMU_BMODE RAM locations to determine the boot mode. The details are in the boot ROM guide (www.ti.com/.../sprufn6a.pdf).  Configure the locations 0x0D00 and 0x0D01 for Boot to Flash mode before loading the code.  

    You can also configure these locations for Flash by running CCS -> Scripts -> EMU BOOT MODE SELECT -> EMU_BOOT_FLASH. 

    Regarding the linker command file:  F2802x RevA devices have the entire Flash API in ROM and hence users do not have to include the software API library in the application and instead link the boot ROM symbols to their project and use the API within the boot ROM directly.  Hence you see two linker command files:  

    1.  Applications that include software API library use Example_Flash28027_SW_API.cmd file.

    2.  Applications that link the boot ROM symbols use Example_Flash28027_ROM_API.cmd file.

    You can get more information on the Flash API usage in the Flash2802x_API_Quickstart.pdf located at C:\ti\controlSUITE\libs\utilities\flash_api\2802x\v201a\doc.

    Thanks and regards,
    Vamsi

  • Preetham,

    Did you try to configure the EMU_KEY and EMU_BMODE locations as suggested?
    Are you able to execute the Flash API example successfully?
    Can I close this thread?

    Thanks and regards,
    Vamsi