Programming flash memory gives random write errors
Hi, I'm trying to program flash on a PIC32 MZ device. I'm using the row programming option.
NVM_RowWrite((int*) block, 0x9d050000, 2048 );
delay_code_us(15000); // To be sure, 15 ms delay
if (memcmp( block, (char*) 0x9d050000, 2048));
memcmp reports unsuccessful writing. When I dump the flash, I find that at the end of the row,
there are usually around ten or twenty words that are set to zero. They are grouped together
in sections of five to ten words.
If the operation would have failed, the words would have been 0xffffffff.
It's a pic32mz0512efe100 device. The code is not write protected. No interrupts involved.
And the WRERR bit is set to zero.
This must be a simple task. The NVM functions ( generated by Harmony ) should do their jobs.