Skip to main content
liyupeng_china
Associate
September 18, 2017
Solved

Could not 'erase sectors' for chip flash

  • September 18, 2017
  • 2 replies
  • 817 views
Posted on September 18, 2017 at 04:08

Hello, when I use IAP in stm32f103vct6, sometimes some of them could not 'erase sectors' , and J-link could not 'erase sectors' to these board too. But I could use 'erase chip' to these board, and then  'erase

sectors

' could be used. Why and how to deal with it? How could i to aviod this happening?

Thanks

    This topic has been closed for replies.
    Best answer by liyupeng_china
    Posted on October 13, 2017 at 11:38

    Sorry, I was wrong. This is because of my code. Sometime I will write data at a not empty place, and this will set the PGERR bit at Flash status register. And then if you don't clear this bit, you will not write a new data at Flash.

    2 replies

    liyupeng_china
    Associate
    September 26, 2017
    Posted on September 26, 2017 at 10:51

    Maybe I kown the answer. Look at this 

    https://stackoverflow.com/questions/28498191/cant-write-to-flash-memory-after-erase

      .

    The problem was that PER bit in FLASH->CR register which is set when FLASH_PageErase() is called isn't cleared at the end of it. Clearing this bit while flash is still unlocked allows other operations on flash to be run after that.

    liyupeng_china
    liyupeng_chinaAuthorBest answer
    Associate
    October 13, 2017
    Posted on October 13, 2017 at 11:38

    Sorry, I was wrong. This is because of my code. Sometime I will write data at a not empty place, and this will set the PGERR bit at Flash status register. And then if you don't clear this bit, you will not write a new data at Flash.