2024-02-21 08:47 PM - edited 2024-02-21 09:16 PM
I am using a stm32h743zi controller i tray to erase one byte and write one byte BUT HERE PROBLEM SECTOR ERASE NOT A ONE BYTE ERASE PLEASE SUGGESTED ME
FLASH_EraseInitTypeDef erase_init={
.TypeErase = FLASH_TYPEERASE_SECTORS ,
.Sector = FLASH_SECTOR_0,
.NbSectors = 1,
.Banks = FLASH_BANK_2,
.VoltageRange = FLASH_VOLTAGE_RANGE_3
};
if (HAL_FLASHEx_Erase(&erase_init,sectorerror) != HAL_OK) {
// Handle erase error
while (1)
{
// Error handling
}
}
flash_address =0x8100000;
// FLASH_Erase_Sector(FLASH_SECTOR_0,FLASH_BANK2_BASE, FLASH_VOLTAGE_RANGE_3);
if (HAL_FLASH_Program(FLASH_TYPEPROGRAM_FLASHWORD, flash_address, ((uint32_t)FlashWord)) == HAL_OK)
{
flash_address = flash_address + 1;
}
Solved! Go to Solution.
2024-02-22 12:19 AM
Welcome @SITARAM, to the community!
I highly recommend that you work through the basics of the structure and function of the flash in your STM32H743, which you can find in RM0433, section 4. This flash is not EEPROM, which can be erased byte by byte, but sectored memory. If you absolutely want to be able to erase byte by byte, you should either consider EEPROM emulation or better connect external EEPROM.
Regards
/Peter
2024-02-22 12:19 AM
Welcome @SITARAM, to the community!
I highly recommend that you work through the basics of the structure and function of the flash in your STM32H743, which you can find in RM0433, section 4. This flash is not EEPROM, which can be erased byte by byte, but sectored memory. If you absolutely want to be able to erase byte by byte, you should either consider EEPROM emulation or better connect external EEPROM.
Regards
/Peter
2024-02-22 03:31 AM
thank you sir