2025-07-30 9:32 AM
Hi,
I’m using EDataBank_1 on an STM32 device to store user data after a power cycle. I based my code on the EraseProgram example and made these changes:
Enabled FlashPeripheral and set EDataBank_1 size = 2
On first boot, I do:
Init → Erase → Program → Read
After a reset, I do:
Init → Read → (optional Program)
(I skip erase to keep the data)
After writing, when I read back, I see userConfig is already set, which I didn’t expect.
I can’t read memory at 0x09000000 using STM32Programmer. It always gives a read error.
Why does userConfig look configured right after a write?
How do I check if EDataBank_1 is still uninitialized (virgin) without erasing?
Is the read error at 0x09000000 due to write failure or ECC error?
How can I detect write errors or ECC issues?
Save data once
Read/write it later without erase
Keep data even after power off
Any help is appreciated. Thanks!
Manikanta
2025-08-05 7:38 AM
Hello @mani9989,
You can check this article for ECC errors: Handling ECC errors in STM32H5 series: Reading unwritten OTP and flash data area
Also, check this application note: AN5342, section 3.2: Dealing with ECC errors in flash memory
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.