2015-09-09 07:49 AM
Hi,
I am trying to do a sector flash erase of an STM32F429 chip. When I call HAL_FLASHx_Erase(&FLASH_EraseInitStruct, §ornb) I get to a call to a function called FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE) and it returns an error: HAL_FLASH_ERROR_PGS or 0x02. What is a programming sequence error and how might I fix it?Thanks,Bob2015-09-09 07:59 AM
''PGSERR: Programming sequence error
Set by hardware when a write access to the Flash memory is performed by the code while
the control register has not been correctly configured. Cleared by writing 1.'' My money would be some other bits in the register, like the program bit or the sector number, or you simply haven't cleared the entry/random state for the status/errors. Or an unexpected write has occurred on the array when it's expecting the erase to complete. ie you timed out of the erase and started writing anyway. The JTAG pod can leave the system in a different state than a cold boot. The state of the flash controller should be cleared after you unlock it, before starting a fresh interaction.
2015-09-09 08:28 AM
Thanks for the advice. It looks like for some reason the SR register had the PGSERR bit set. Once I added some code to clear that bit during my flash init code, it started working!