[BUG] in STM32CubeF7 EEPROM_Emulation Project: Function EE_VerifyPageFullyErased() can't verify if PAGE1 is erased.
Hey All,
I'm using the STM32CubeF7 v1.15.0 Lib.
If I look in any EEPROM_Emulation Project in the file eeprom.c, there is all the time the same issue with the function EE_VerifyPageFullyErased() starting at line 328:
/**
* @brief Verify if specified page is fully erased.
* @param Address: page address
* This parameter can be one of the following values:
* @arg PAGE0_BASE_ADDRESS: Page0 base address
* @arg PAGE1_BASE_ADDRESS: Page1 base address
* @retval page fully erased status:
* - 0: if Page not erased
* - 1: if Page erased
*/
uint16_t EE_VerifyPageFullyErased(uint32_t Address)
{
uint32_t ReadStatus = 1;
uint16_t AddressValue = 0x5555;
/* Check each active page address starting from end */
while (Address <= PAGE0_END_ADDRESS)
{
/* Get the current location content to be compared with virtual address */
AddressValue = (*(__IO uint16_t*)Address);
/* Compare the read address with the virtual address */
if (AddressValue != ERASED)
{
/* In case variable value is read, reset ReadStatus flag */
ReadStatus = 0;
break;
}
/* Next address location */
Address = Address + 4;
}
/* Return ReadStatus value: (0: Page not erased, 1: Sector erased) */
return ReadStatus;
}Only the PAGE0 is checked, because the condition in the while loop only checks, if end of PAGE0 is reached.
If the function parameter is PAGE1_BASE_ADDRESS, the function will all the time return "Page erased" even if PAGE1 is not erased.
So for example the function EE_Format() won't work correctly which is critical in case of illegal states in the Init phase.
I have handled this issue by setting a variable PageEndAddress, depending on the function parameter Address.
Maybe a ST Employee can forward this issue to the MCD Application Team.
Best regards
Julian
