2021-11-30 07:12 AM
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.
2021-11-30 01:30 PM
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.
2021-11-30 01:54 PM
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