I need to save some data (a hundred bytes) in a non-volatile manner on the
above board.
The app is running from flash, bank 0, and the app note 111330 from ST
says it can read/write to the other flash bank.
However, access is very flaky- or non-existent.
I am using the str71x libraries.
My basic work flow is:
u32 data;
FLASH_Init();
data = FLASH_WordRead(0x0C0000);
if ((data == 0) ||
(data > 20))
{
// Perform calibration
data = 1;
FLASH_SectorErase(FLASH_B1F0);
FLASH_WordWrite(0x400C0000,
data);
}
The unit either “reboots” or hangs up on the SectorErase(). Then it
might write the data or hang there. Re-reading the data might show it
has written or maybe not. If I try to write the whole dataset (about
100 bytes) the unit tends to hand on the write, but some of the data
is saved.
It seemd there is some trick involved that I am missing.
Does anyone have advice/clues/pointers/working code?
Thanks