Skip to main content
baranovus
Associate III
December 20, 2017
Solved

STM32F0 series. Waiting for Page Write/Erase completion.

  • December 20, 2017
  • 3 replies
  • 926 views
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
    This topic has been closed for replies.
    Best answer by Tesla DeLorean
    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.

    3 replies

    Tesla DeLorean
    Guru
    December 20, 2017
    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
    baranovus
    baranovusAuthor
    Associate III
    December 20, 2017
    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?

    Tesla DeLorean
    Tesla DeLoreanBest answer
    Guru
    December 20, 2017
    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..