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.

EK-TM4C1294XL: Save/store struct on Flash

Part Number: EK-TM4C1294XL


Hi, everybody,
Firstly, thanks to all people in this community, it is a really good information source..

I want to  use the Flash_PB library to write the Flash, this library is on the tivaware/utils provided by TI. I followed some examples with no results.


I am using the TM4C1294XL connected launchpad, Windows 7, CCS V7, and TI 16.9.1 LTS compiler.
I am just playing with flash, to store some permanent parameters. My struct is really simple: only 2 uint32_t variables.

When the system powers-up, I init the Flash block and the variables if there is no valid parameter block

FlashPBInit(0x3F800,0x40000,512);

if(!pucParamBlock) { // If there is no valid flash parameter block then...

tFlashParams.var1=0x01;
tFlashParams.var2=0x02; // Initialize all the variables in global struct to their default values

FlashPBSave((unsigned char*) &tFlashParams); // ...and write the struct with default values to flash

}




after user pushes a push-button, this variables are increased and then stored in the Flash:


tFlashParams.var1++;
tFlashParams.var2++;

//

FlashPBSave((unsigned char*)&tFlashParams);    //write struct on flash



Then, I get the values:


pucParamBlock=FlashPBGet();
memcpy(&tFlashParams,pucParamBlock,uLen);

This is not working, I get values with no sense. I wave no idea why. Maybe I am not understanding how the flash memory is used to store this, I am quite lost.

Thanks!
jordi