Other Parts Discussed in Thread: HALCOGEN
Hello,
I'm using FEE to save multiple Blocks of data onto emulated EEPROM. My ti_fee_cfg is found below.
I need a Virtual Sector of greater than 16K because the largest block that is written takes about 20K. So I use 2x2 Physical Sectors (i.e. the whole Bank 7) as 2 Virtual Sectors.
The large Block is written rarely (calibration information is stored here), whereas one of the smaller blocks (384Byte) is written much more frequently. During normal operation, everything works well:
- When the smaller block is written, the previous valid block is marked invalid and the the new block becomes valid
- When writing of the smaller block requires changing the virtual sector, everything works well too -> the other valid blocks are copied on the new virtual sector and the data is valid.
Bad things happen when a power loss occurs during writing the smaller block and a change of Virtual Sector is required. It seems the other valid blocks (especially the largest block) are not copied correctly to the new V-Sector. After restart, no valid block can be found for the large one. Another restart and the data seems to be corrupted completely (FEE driver finds a valid block but the data stored is corrupted).
I read out the whole bank (both virtual sectors) and found pieces of the large block (by searching for the block size and number which is quite unambiguously):
Offset Block Status
069C -> Start Prev. Addr: 0xF020 0020
3BFC -> Valid Prev. Addr: 0xF020 0020
869C -> Start Prev. Addr: 0xF020 0020
A02C -> Start Prev. Addr: 0xF020 0020
On a correctly working FEE, there are only 2 hits (one within each V-Sector).
The "Valid" Block can't be correct, as there is not enough space on the V-Sector (0x3BFC + 0x4FFB > 0x8000), so it's clear that these data have to be corrupted.
There might be another reason for data loss:
My application consists of an modified version of the Safety-Bootloader and the Application itself. The Bootloader needs to access the FEE to get the Starting Address of the Application. That's why the Bootloader initializes the FEE driver and later jumps into the Application. The Application however initializes the FEE a second time.
Might this be an issue which could lead to this behaviour or is this a known issue caused by other problems?
My configuration below:
Thanks in advance
/** @struct Fee_VirtualSectorConfigType */
/* @brief Virtual Sector Configuration */
const Fee_VirtualSectorConfigType Fee_VirtualSectorConfiguration[TI_FEE_NUMBER_OF_VIRTUAL_SECTORS] =
{
/* Virtual Sector 1 */
{
/* Virtual sector number */ 1U,
/* Bank */ 7U,
/* Start Sector */ (Fapi_FlashSectorType)0U,
/* End Sector */ (Fapi_FlashSectorType)1U
},
/* Virtual Sector 2 */
{
/* Virtual sector number */ 2U,
/* Bank */ 7U,
/* Start Sector */ (Fapi_FlashSectorType)2U,
/* End Sector */ (Fapi_FlashSectorType)3U
}
};
/* Block Configurations */
/* SourceId : HL_Fee_SourceId_2 */
/* DesignId : HL_FEE_DesignId_3, HL_FEE_DesignId_8 */
/* Requirements : HL_FEE_SR2, HL_FEE_SR3, HL_FEE_SR4, HL_FEE_SR6, HL_FEE_SR85, HL_FEE_SR86
HL_FEE_SR87, HL_FEE_SR88, HL_FEE_SR89, HL_FEE_SR90, HL_FEE_SR91 */
const Fee_BlockConfigType Fee_BlockConfiguration[TI_FEE_NUMBER_OF_BLOCKS] =
{
/* Block 1 */
{
/* Block number */ 1U,
/* Block size */ 64U,
/* Block immediate data used */ TRUE,
/* Number of write cycles */ 0x8U,
/* Device Index */ 0x00000000U,
/* Number of DataSets */ 1U,
/* EEP number */ 0U
}
,
/* Block 2 */
{
/* Block number */ 2U,
/* Block size */ 384U,
/* Block immediate data used */ TRUE,
/* Number of write cycles */ 0x8U,
/* Device Index */ 0x00000000U,
/* Number of DataSets */ 1U,
/* EEP number */ 0U
}
,
/* Block 3 */
{
/* Block number */ 3U,
/* Block size */ 384U,
/* Block immediate data used */ TRUE,
/* Number of write cycles */ 0x8U,
/* Device Index */ 0x00000000U,
/* Number of DataSets */ 1U,
/* EEP number */ 0U
}
,
/* Block 4 */
{
/* Block number */ 4U,
/* Block size */ 384U,
/* Block immediate data used */ TRUE,
/* Number of write cycles */ 0x8U,
/* Device Index */ 0x00000000U,
/* Number of DataSets */ 1U,
/* EEP number */ 0U
}
,
/* Block 5 */
{
/* Block number */ 5U,
/* Block size */ 64U,
/* Block immediate data used */ TRUE,
/* Number of write cycles */ 0x8U,
/* Device Index */ 0x00000000U,
/* Number of DataSets */ 1U,
/* EEP number */ 0U
}
,
/* Block 6 */
{
/* Block number */ 6U,
/* Block size */ 64U,
/* Block immediate data used */ TRUE,
/* Number of write cycles */ 0x8U,
/* Device Index */ 0x00000000U,
/* Number of DataSets */ 1U,
/* EEP number */ 0U
}
,
/* Block 7 */
{
/* Block number */ 7U,
/* Block size */ 128U,
/* Block immediate data used */ TRUE,
/* Number of write cycles */ 0x8U,
/* Device Index */ 0x00000000U,
/* Number of DataSets */ 1U,
/* EEP number */ 0U
}
,
/* Block 8 */
{
/* Block number */ 8U,
/* Block size */ 20475U,
/* Block immediate data used */ TRUE,
/* Number of write cycles */ 0x8U,
/* Device Index */ 0x00000000U,
/* Number of DataSets */ 1U,
/* EEP number */ 0U
}
,
/* Block 9 */
{
/* Block number */ 9U,
/* Block size */ 4095U,
/* Block immediate data used */ TRUE,
/* Number of write cycles */ 0x8U,
/* Device Index */ 0x00000000U,
/* Number of DataSets */ 1U,
/* EEP number */ 0U
}
,
/* Block 10 */
{
/* Block number */ 10U,
/* Block size */ 512U,
/* Block immediate data used */ TRUE,
/* Number of write cycles */ 0x8U,
/* Device Index */ 0x00000000U,
/* Number of DataSets */ 1U,
/* EEP number */ 0U
}
,
/* If project needs more than 16 blocks, add additional blocks here and also
modify TI_FEE_TOTAL_BLOCKS_DATASETS and TI_FEE_NUMBER_OF_BLOCKS in ti_fee_cfg.h */
/* USER CODE BEGIN (1) */
/* USER CODE END */