2010-07-14 01:36 AM
AN 2594 - cant read data back ...
2011-05-17 04:58 AM
You sure you are doing not just checking the return value, but called EE_ReadVariable with the correct pointer?
You didn't include any code, that's why the questions might be silly :p2011-05-17 04:58 AM
2011-05-17 04:58 AM
EEprom emulation, described in AN 2594 works OK. I have had it working on an STM32F100 micro. Here are a few things I have spotted from your code:
1.
Ensure you call the following in the correct order:
FLASH_Unlock();
EE_Init();
EE_WriteVariable
2. You are not incrementing the address pointer of the array that you send to EE_ReadVariable, also when you call it only one int is returned. Then you try and print an array that has not been populated Try passing a pointer of a 16 bit int then load that into your array and call EE_ReadVariable in your for loop.
if (0 == strcmp(argv[1], ''r''))
{ n=EE_ReadVariable(VirtAddVarTab[1], data); printf(''\nRd = %d\n'',n) ; for (VarValue = 0; VarValue < 50; VarValue++) { printf(''%d -'',data[VarValue] ) ; } }3.
VirtAddVarTab[1] is just one virtual address so every time you call EE_WriteVariable with VirtAddVarTab[1] you are updating different flash locations with the same virtual address.
e.g. 1 = 100
1 = 99
1 = 98
1 = 97….. and so on
Then when you call EE_ReadVariable you will return the last VirtAddVarTab[1] updated in flash.
So you may want to increment the virtual address pointer. Hope this helps!