cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G474 FLASH memory programming results in occasional PGAERR (alignment error)

KMack.1
Associate

With FLASH in DUAL BANK mode (DBANK = 1) and programming the second BANK via 64-bit writes, I get an occasional PGAERR alignment error (0 to 25 per full BANK write, 256K)

Verifying the FLASH data written, I can see that the number of PGAERR errors corresponds to the number of locations not programmed (remains all "F").

Errors appear to go away when you turn off SysTick (set at 1ms). We can also change the rate of errors by changing the rate of interrupts from a timer.

Program code is executing from the first BANK. Disabling data cache did not help.

2 REPLIES 2
TDK
Guru

Do you also have MISSERR flag set?

Probably in fast programming mode, the second word isn't written fast enough (due to interrupt taking away priority) which causes MISSERR, then when it does try to write it, causes PGAERR since it's not aligned.

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

No MISERR errors. Using standard programming, not fast.

We suspect an interrupt is causing the alignment problem.

In one test, we added "__disable_irq() / __enable_irq()" around our flash_write() and the PGAERR errors go away