cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F0 series. Waiting for Page Write/Erase completion.

baranovus
Associate III
Posted on December 20, 2017 at 18:20

Hello all.

HAL uses function 'FLASH_WaitForLastOperation' for polling flash 'BUSY' flag, while performing flash page erase or flash write. How can this function be executed from flash if flash bus is blocked during flash erase? Is CPU simply staying in stalled state instead of polling BUSY flag while a page is being erased?  Is it a bug in HAL or an intentional trick?

#waiting-for-page-write/erase-completion
1 ACCEPTED SOLUTION

Accepted Solutions
Posted on December 20, 2017 at 19:07

Not sure I'd class this as a bug. You get to choose how to use the library, ramifications of the FLASH stalling are systemic and not simply addressed by tagging one function.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

3 REPLIES 3
Posted on December 20, 2017 at 18:26

It simply stalls, ie stuffs wait states. If you don't want the code to stall, you need to move the code and all its dependencies, vector tables, etc into RAM.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
baranovus
Associate III
Posted on December 20, 2017 at 18:57

So, do I understand correctly that the use of '

FLASH_WaitForLastOperation' without moving it to RAM (e.g. using __ramfunc attribute if in iAR) is a bug?

Posted on December 20, 2017 at 19:07

Not sure I'd class this as a bug. You get to choose how to use the library, ramifications of the FLASH stalling are systemic and not simply addressed by tagging one function.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..