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.
Tool/software: Code Composer Studio
Hi
i need to handle a counter in the FLASH, so every power off and on the current number would not lost.
is there any addresses avalible in the Flash? if yes, how do i access them?
Thanks!
Shimon,
TMS320F28377D has 512KB of Flash per CPU. Please check Table 6.3.2 Flash Memory Map in datasheet at .
You can dedicate couple of Flash sectors for data and you can use them to program your counter data. Refer to this thread on how you can use Flash for this purpose: Use EEPROM(Flash) for data retention in TMS320F2808 Microcontroller - C2000 microcontrollers forum -...
You can use F021_API_F2837xD_FPU32.lib (Flash API library) to erase/program the Flash. This library is available at controlSUITE\device_support\F2837xD\v210\F2837xD_common\lib.
Flash API usage example is also available at controlSUITE\device_support\F2837xD\v210\F2837xD_examples_Dual\flash_programming.
Flash API documentation is available at controlSUITE\device_support\F2837xD\v210\doc\FlashAPI_Doc.
Note that you can not erase/program Flash while executing the code from Flash. Hence, you need to have a RAM run address for Flash API functions (and for the functions that call the Flash API functions) as shown in the example mentioned above.
Hope this helps.
Thanks and regards,
Vamsi
Shimon,
I think you are asking about my suggestion of running the Flash API from RAM. Flash bank on F2837xD should not be accessed (for fetches/reads) when a Flash erase/program operation is in progress on that bank. Hence, you can not execute the Flash API from the Flash bank on which you want to perform erase/program operations. Instead you can assign the Flash API library to .TI.ramfunc section (check flash_programming_cpu1_FLASH.cmd file at controlSUITE\device_support\F2837xD\v210\F2837xD_examples_Dual\flash_programming\cpu01) and copy the Flash API functions from Flash to internal RAM at run time using memcpy() function before executing the Flash API functions. This way, the Flash API gets loaded to Flash but will be copied to RAM for doing erase/program operations on the Flash bank.
If you step-in to the InitSysCtrl() function in the example that I pointed to you in my previous reply on this post, you will notice the memcpy() function usage.
Let me know if you have any questions.
Thanks and regards,
Vamsi
Shimon,
You don't have to erase the sector every time you want to update the value. You can implement a simple EEPROM emulation method in Flash as explained in https://e2e.ti.com/support/microcontrollers/c2000/f/171/t/319481 - This way you don't have to erase the Flash for every update.
You can implement the timer in RAM (or check for CPU Timers in TRM at http://www.ti.com/lit/ug/spruhm8f/spruhm8f.pdf) and update the value in Flash before a power down. CPU Timers in the device get reset for a power cycle/reset.
Thanks and regards,
Vamsi
Hi Vamsi
thanks for the info. the link to the thread links to other thread, where they reccomended using the Eeprom emulator. i will check this out.
Thanks!
Shimon,
The EEPROM concept is similar. However, the Flash API functions that you use are different between the two devices.
Also, F2837xD Flash has ECC. This will require you to program a minimum of 64-bits (aligned on 64-bit boundary) at a time on F2837xD. Hence, you have to allocate a minimum of 64-bits for a variable even if it needs only 16-bits or 32-bits.
Thanks and regards,
Vamsi
Shimon,
In F2823x device linker cmd files, we used to use two sets of symbols - one set for ramfuncs and another set for Flash28_API as copied below from the corresponding linker command file.
Flash28_API:
{
-lFlash28335_API_V210.lib(.econst)
-lFlash28335_API_V210.lib(.text)
} LOAD = FLASHD,
RUN = RAML0,
LOAD_START(_Flash28_API_LoadStart),
LOAD_END(_Flash28_API_LoadEnd),
RUN_START(_Flash28_API_RunStart),
PAGE = 0
ramfuncs : LOAD = FLASHD,
RUN = RAML0,
LOAD_START(_RamfuncsLoadStart),
LOAD_END(_RamfuncsLoadEnd),
RUN_START(_RamfuncsRunStart),
PAGE = 0
For the F2837xD and other latest devices, we are using only one set of symbols for both the ".TI.ramfunc" section and the Flash API library as shown below by using GROUP directive (Below is taken from controlSUITE\device_support\F2837xD\vx\F2837xD_examples_Dual\flash_programming\cpu01flash_programming_cpu1_FLASH.cmd file). These symbols are defined by the linker during the link step. All these symbols are declared in F2837xD_GlobalPrototypes.h file.
GROUP
{
.TI.ramfunc
{ -l F021_API_F2837xD_FPU32.lib}
} LOAD = FLASHD,
RUN = RAMLS03,
LOAD_START(_RamfuncsLoadStart),
LOAD_SIZE(_RamfuncsLoadSize),
LOAD_END(_RamfuncsLoadEnd),
RUN_START(_RamfuncsRunStart),
RUN_SIZE(_RamfuncsRunSize),
RUN_END(_RamfuncsRunEnd),
PAGE = 0
Thanks and regards,
Vamsi