2024-02-21 06:36 AM - edited 2024-02-23 02:43 AM
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?
Solved! Go to Solution.
2024-02-23 02:22 AM
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.
2024-02-21 07:08 AM
How are you verifying the page is not erased? What tool and memory addresses are you looking at?
2024-02-21 07:14 AM
I am monitoring the page content using the Memory renderer of STM32Cube Ide, there are values different from the erased value 0xFFFFFFFF
2024-02-21 07:15 AM
2024-02-21 07:43 AM
Hello @Adriano Melis
The page 127 in bank1 is in 0x080F E000 - 0x080F FFFF
the screenshot you showed, does not show page 127
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-02-21 07:50 AM
2024-02-21 07:51 AM - edited 2024-02-21 07:54 AM
my bad. this is an actual screenshot: Flash erase has been executed, FLASH content is unchanged.
(status value is HAL_OK)
2024-02-21 09:06 AM
Hello @Adriano Melis,
I tried to reproduce your issue using the FLASH_EraseProgram example in STM32U5CubeFW, however, page 127 was erased successfully and I couldn't reproduce it
Maybe share a minor project to reproduce it on my side.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-02-22 12:23 AM
hello, these are additional info:
2024-02-22 02:21 AM
Hello @Adriano Melis
I suppose you're setting Flash latency to 3WS?
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.