cancel
Showing results for 
Search instead for 
Did you mean: 

FLASH_Program_DoubleWord(Address, Data) creating issue

ANaga.2
Associate II

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

2 REPLIES 2
TDK
Guru

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.

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

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.