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.
Dear Users,
I want to use a small part of the TMS570's flash memory to store a value (64 bit number) during runtime. If the controller is turned off an on again, the value should be restored from the flash memory. I could not find anything helpful about this topic in it's datasheet or the internet. Is there any example code for writing and reading flash memory during runtime? Any answer would be helpful.
Best regards
Michel
Hello Sunil,
thank you for your reply. I found an example code "C:\ti\Hercules\HALCoGen\v04.07.00\examples\TMS570LS04x_03x_02x\example_TI_Fee_Write_Read.c". I don't want to test the flash memory, so is the following code enough:
#define BLOCK_NUMBER 0x01 sint64 value = 0; void main() { TI_Fee_Init(); readValue(); // ... while (1) { if (/* value changed */) { writeValue(); } // ... } } void readValue() { TI_Fee_Read(BLOCK_NUMBER, 0, &value, 8); } void writeValue() { TI_Fee_WriteAsync(BLOCK_NUMBER, &value); }
Then I'd like to ask the following questions:
1. What's the difference between WriteSync and WriteAsync?
2. I found that the block size is configured in ti_fee_cfg.c file, but where do I programm the adress where the value is stored in flash memory?
3. What ist the TI_Fee_MainFunction() used for?
Best regards
Michel
Hi Vishwanath,
so do I need to call this TI_Fee_MainFunction after calling TI_Fee_Init() like this:
do { TI_Fee_MainFunction(); delay(); Status=TI_Fee_GetStatus(0); } while(Status!= IDLE);
Or does the init function call this itself?
If I understood you correctly, I could use the TI_Fee_WriteSync() function in writeValue() function to avoid calling the above loop.
Since I haven't used the EEPROM before all the space should be free.