Skip to main content
Senior III
May 7, 2026
Question

New STM32_ExtMem_Manager driver for STM32H7S7 won't erase/write sectors

  • May 7, 2026
  • 1 reply
  • 99 views

I'm using an STM32H7S78-DK board and I have a part of the firmware that, from the boot, updates the FLASH from a .bin inside an SD card

The code is pretty simple as I loop the FLASH comparing every sector with the one in the SD card and, if different I erase the internal flash sector and write the new one.

Everything was working correctly until a update the code via CubeMX

The read seems to still working

if (EXTMEM_Read(0, fw_offset, flash_buf, br) != 0)

but as soon as I do the

if (EXTMEM_EraseSector(0, fw_offset, FLASH_SECTOR_SIZE) != 0)

I got an error

The crash happens in

 if (EXTMEM_DRIVER_NOR_SFDP_OK != EXTMEM_DRIVER_NOR_SFDP_SectorErase(&extmem_list_config[MemId].NorSfdpObject,
 local_address, sector_type))
 {
 retr = EXTMEM_ERROR_DRIVER;
 }

I've rolled back just the driver in the STM32_ExtMem_Manager, and everything started working again

I've noticed that quite a few files have been changed, including the addition of #define EXTMEM_DRIVER_CUSTOM     0

In the conf_template, it could be helpful to understand what's changed. Everything else has stayed the same. Where should I look?

 
Another thing that has changed, if it is useful to understand the changes, is that in stm32_sfdp_driver.c the 
#define ERASE_COMMAND 0x60 has been deleted
 
What could be the issue?
 
I've just found out that I've updated from SLA0044 Rev5/February 2018 to SLA0044 Rev6/October 2025

1 reply

Guenael Cadier
ST Employee
May 11, 2026

Hi @nico23 
I guess you are now using ExtMemManager v1.5.0 right ?
And that you were previously using v1.3.0 ?

The 1.5.0 version contains addition of a new driver inside EMM, called CUSTOM. It is fully separated from the NOR_SFDP driver, so should have no impact on the use of NOR_SFDP driver, as in your configuration.

ERASE_COMMAND define was removed in v1.4.0 and has been replaced by SFDP_DRIVER_ERASE_CHIP_COMMAND which is now located in stm32_sfdp_driver_type.h (same value).
(this define corresponds to the full chip erase instraction, so should not be used when performing EXTMEM_DRIVER_NOR_SFDP_SectorErase().)

If you debug inside EXTMEM_DRIVER_NOR_SFDP_SectorErase() what is the command and type of erase operation that will be executed ?
What is the error code returned by EXTMEM_DRIVER_NOR_SFDP_SectorErase() ?

Regards