2023-01-20 01:19 AM
Hi,
I always take an error "EEPROM_ERROR_FLASH_PROGRAM" while I was trying to write some data on EEPROM.
So, I debugged and realized It returned an error in verify stage.
I give uint32 WriteBuffer[100] and It makes 400 bytes.
In verify stage EEPROM driver is using a counter that the data type is uint8. So, It means just 256 bytes can be verified.
But there is no limit control on the eeprom_write function and no warning for about this.
uint32_t actualsize;
uint16_t idsize;
uint64_t buffer;
uint32_t buffaddress;
uint8_t counter;
uint8_t i;
uint32_t returnvalue;
uint32_t address;
uint32_t idaddress;
uint32_t alignedbytes;
uint32_t notalignedbytes;
uint32_t nuomofcycles;
uint32_t tempsource;
uint8_t invalidateid;
.
.
.
/* Verify written data */
address = eepromp->config->blockConfig[eepromp->currentBlock].startAddr + eepromp->config->blockConfig[eepromp->currentBlock].size
- eepromp->freespace;
address += 16U; /*point to data */
for (counter = 0; counter < size; counter++) {
if (FLASHREAD8(address) != EEPROM_READ8(tempsource)) {
return EEPROM_ERROR_FLASH_PROGRAM;
}
tempsource++;
address++;
}
.
.
.