cancel
Showing results for 
Search instead for 
Did you mean: 

How does HAL_FLASHEx_Erase_IT work?

OBorr.1
Associate II

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!

3 REPLIES 3
DBroo.1
Associate III

Great question!

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
Up vote any posts that you find helpful, it shows what's working..
modonga
Associate II

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