cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U575VGT HAL_FLASHEx_Erase() not working (page is not erased)

Adriano Melis
Associate III

Hello all,

this code snippet is not working: the page is not erased, although the HAL does not report errors.

No RTOS is running.

 

if (HAL_ICACHE_Disable() != HAL_OK) {

Error_Handler();

}

 

status = HAL_FLASH_Unlock();

if (status != HAL_OK) {

Error_Handler();

}

 

erase_init_struct.TypeErase = FLASH_TYPEERASE_PAGES;

erase_init_struct.Banks = FLASH_BANK_1;

erase_init_struct.Page = 127;

erase_init_struct.NbPages = 1;

 

status = HAL_FLASHEx_Erase(&erase_init_struct, &page_error);

if (status != HAL_OK) {

Error_Handler();

}

 

Any suggestion?

 

 

 

12 REPLIES 12

correct. I tried 15 WS without any improvement.

Adriano Melis
Associate III

Attached two cube projects, mcb-fw-FLASH-IAP is for U575VGT (NOT working), IAP is for U575ZI (working on the Nucleo board).

As you can see the code is the same.

 

Adriano Melis
Associate III

Hello all,

I found the source of the problem: the DUALBANK bit in FLASH_OPTR was set to 1.

On this device this arranges the FLASH page access in two banks of 64 pages each.