Skip to main content
Explorer II
February 22, 2024
Solved

STM32H743ZI INTERNAL FLAsh memory 1 byte Erase and Write issue

  • February 22, 2024
  • 1 reply
  • 1043 views

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;
}

    This topic has been closed for replies.
    Best answer by Peter BENSCH

    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

    1 reply

    Technical Moderator
    February 22, 2024

    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

    SITARAMAuthor
    Explorer II
    February 22, 2024

    thank you sir