Skip to main content
December 9, 2022
Solved

Flash programming stuck until sector erased

I faced strange behavior on STM32L431CC. I was trying to sequentially add data to archive and at some point the CPU failed to program 8 bytes at address 0x8032018 (8 byte aligned) and at address 0x8034100. I read data from the memory and it is clear (0xff's in all 8 bytes), but unless I program clear 0 I got 0xa8 error (PROGERR, PGAERR, PGSERR). After I erased sector the same value was successfully programmed to the same address.

And few other facts:

1) The other sectors was successfully programmed while two others are not

2) The same sectors still stuck after power on reset

3) When one of stuck sectors was erased the other remained stuck

4) I was unable to reproduce the situation after I erased both these sectors

Just wondering what it was and should I expect this in the future? Not found anything similar on the forum or in errata.

This topic has been closed for replies.
TDK
TDKBest answer
December 9, 2022

0xFF doesn't necessarily indicate that you can write to it. If you program 0xFF's, you're still programming it, and you still can't program to it again without an erase. This is true on chips with ECC, including the STM32L431. Given your symptoms, seems like the memory was programmed before with 0xFFs in those spots.

"If you feel a post has answered your question, please click ""Accept as Solution""."

2 replies

TDK
TDKBest answer
December 9, 2022

0xFF doesn't necessarily indicate that you can write to it. If you program 0xFF's, you're still programming it, and you still can't program to it again without an erase. This is true on chips with ECC, including the STM32L431. Given your symptoms, seems like the memory was programmed before with 0xFFs in those spots.

"If you feel a post has answered your question, please click ""Accept as Solution""."
December 9, 2022

Oh, that most likely true. I didn't knew that and it is not obvious. Thanks a lot!​