2019-03-11 08:49 AM
I am working with the STM32F446 microcontroller and for over a year I've successfully been able to erase sectors from within my code using FLASH_Erase_Sector. Now all of a sudden my code gets stuck whenever I call it! I have looked at the Option Bytes using STM32 ST-LINK Utility and everything looks fine, nothing is write protected. I'm also able to re-program the microcontroller from another microcontroller using the build-it STM bootloader. What on earth has happened to my microcontroller, why does it refuse to erase sectors from within its source code, but not from externally?
2019-03-11 02:03 PM
Without specific diagnostics it will be hard to tell.
I'd make sure to clear any pending status from the FLASH unit before starting an erase/programming cycle.
2019-03-11 04:46 PM
What voltage parameter do you specify for the erase?
Is this voltage indeed supplied to the MCU?
-- pa
2019-03-11 11:10 PM
The specied voltage range and the supplied voltage are both correct.
When I think back, the problem was introduced at about the same time as I introduced a reset pulse that probably was too short (way less than 20 microseconds). So, it is possible that the microcontrollers (there are actually 4 of them and they all have the same problem) were reset with reset pulses that violated the reset hold time while it was either erasing a sector or programming a sector. But can this really create permanent damage? Can I recover them somehow?
2019-03-11 11:36 PM
This looks like more then just a coincidence. IMHO a question for ST.
2019-03-12 02:06 AM
When I read address 0x1FFF C008 (the second option byte) it says 0x30FF, but when upgrading firmware I set it to 0x00FF. Now, bits 14:8 are reserved so maybe it doesn't matter, but maybe it's a clue as what is wrong?