2020-08-27 04:07 AM
Hi,
I am using STM32L476RG MCU and trying to store some values in the EEPROM.
When I try to program a 64 bit data, FLASH_Program_DoubleWord(Address, Data) is called and it is failing to program the data.
FLASH->SR is set to 160 which I assume Fast programming data miss error.
Could anyone tell me what is the problem?
the 64 bit data is 0xa1c50001 and the address is 0x8080020.
Thanks,
Ankush
2020-08-27 06:27 AM
From the reference manual:
Bit 7 PGSERR: Programming sequence error
Set by hardware when a write access to the Flash memory is performed by the
code while PG or FSTPG have not been set previously. Set also by hardware
when PROGERR, SIZERR, PGAERR, MISSERR or FASTERR is set due to a
previous programming error.
Cleared by writing 1.
Bit 5 PGAERR: Programming alignment error
Set by hardware when the data to program cannot be contained in the same 64-
bit Flash memory row in case of standard programming, or if there is a change of
page during fast programming.
Cleared by writing 1.
The address is 64-bit word aligned, so maybe you're programming to multiple pages in the same sequence.
> the 64 bit data is 0xa1c50001
That's 32 bits of data.
2020-08-28 02:07 AM
Thanks TDK. I found the problem. From the other task in the application Flash was locked and it never unlocked after it has finished executing a task.
After unlocking it, EEPROM is working as expected.