cancel
Showing results for 
Search instead for 
Did you mean: 

Could not 'erase sectors' for chip flash

liyupeng_china
Associate II
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

1 ACCEPTED SOLUTION

Accepted Solutions
liyupeng_china
Associate II
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.

View solution in original post

2 REPLIES 2
liyupeng_china
Associate II
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
Associate II
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.