Skip to main content
OBorr.1
Associate
Dec 16, 2021 12:39 PM UTC
Question

How does HAL_FLASHEx_Erase_IT work?

Hi guys!

I'm here again needing yor help regarding the Flash memory function HAL_FLASHEx_Erase_IT. I was erasing the Flash memory using the HAL_FLASHEx_Erase function, but as i need to avoid any function that could block my program, I changed to the interrupt function.

To use this function I turned on the Flash global interrupts and I have alredy tried the HAL_FLASH_EndOfOperationCallback, however, i didn't get to make it work.

I'd like any help of how to use HAL_FLASHEx_Erase_IT correctly.

Thanks!

This topic has been closed for replies.

3 replies

DBroo.1
Associate III
Aug 16, 2022 1:37 PM UTC

Great question!

Tesla DeLorean
Guru
Aug 16, 2022 3:56 PM UTC

Show Code, it's hard to determine why it isn't working.

What STM32? So we can narrow it down a tad..

Yes, should generate a call-back if you have the IRQHandler in place, NVIC enabled, and call into the HAL service routine.

System will still stall/block unless ALL other functionality occurs entirely in RAM, or a different FLASH Bank

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Associate II
Nov 23, 2023 7:12 PM UTC

the function "HAL_FLASHEx_Erase_IT" dont have any BLOCKING CODE. but make carefully that you can only erase a page per page. Because 1 FLASH->CR instruction is capable to erase onle 1 page at time....
in another hand you have the "HAL_FLASHEx_Erase" that is fill with Blocking code like waits makes with "while(bla bla...)"

 

the principal difference is:

HAL_FLASHEx_Erase_IT:
has the EOPIE, ERRIE =1 in the FLASH->CR Register
HAL_FLASHEx_Erase_IT:
has the EOPIE, ERRIE =0 in the FLASH->CR Register

i Know that this is an old thread but i hope this can help anyone