EEPROM Emulation with STR71x
Table 2. Status bit for Data-set
Status bit value
11
Meaning
Data-set without data (virgin)
01
Data-set with valid data (programmed)
00
Data-set with old or invalid data (dirty)
10
Reserved (invalid)
With those combinations, the status bits will change from “11”, combination after erase,
through “01” until “00”, configurations reached by incremental bit programming. Reserved
configuration should be used by user’s software to detect which Flash bank holds valid data.
User’s software should define rules on handling Data-set status bits so that in any possible sit-
uation in the application (ex: CPU reset), the software can retrieve which bank is active and
which Data-set has the valid information.
Example: when the data has been successfully written into the new Data-set, the status bits of
the new and old Data-sets must be updated. A specific sequence to achieve these updates
should be defined.
2.6 ACTIVE FLASH BANK SELECTION
The detection of the active Flash bank after power-up should rely on the analysis of the infor-
mation inside the banks. To support this analysis, specific status bits in each Flash bank can
be used to specify when the relevant data is on the other Flash bank. The following table
shows an example of status bits that can be used for this purpose.
Table 3. Status bit for Flash banks
Status bit value
01111111
Current bank is active
Meaning
00111111
Erase of the other bank is started
00011111
00001111
Completion of the erase of the other bank
New data programming in the other bank is started
00000111
New data programming in the other bank is completed
00000011
The other bank is active
To improve the detection in case of partially erased bank and as explained in Section 1, it is
proposed to insert a small number of fixed data inside the Data-sets so that by running
checksum it is possible to detect if a given Flash bank has valid or invalid data.
Then, the EEPROM emulation software should analyse the content of the Flash banks de-
tected to contain valid data, in order to check the consistency of the status bits. This algorithm
is application-dependent as the possible combinations depend on the selected implementa-
tion and the different events that the application has to withstand due to the design features
(for example, a power-fail).
7/19