When I do a page write (SPM) without a page erase it works the same.
So why still need to do a page erase as the datasheet tells?
Generally, you can "program" bits in only one direction. If the difference between the new value and current value of any bit is opposite that, it won't get changed and the stored data will be wrong.
Until Black Lives Matter, we do not have "All Lives Matter"!
It does NOT work the same.
When you fill the page buffer and then do a SPM page write, this is the effect:
For every bit in the buffer that is cleared (0), the corresponding bit in Flash will also be cleared (0).
For every bit in the buffer that is set (1), the corresponding bit in Flash will remain unchanged. (Ie. if the Flash used to hold a '1' in that position, then it will continue (correctly) to hold a '1' afterwords. If the Flash used to hold a '0' in that position, then the '0' will (probably incorrectly) remain.
Those are the only two operations that can possibly happen. This offers some interesting possibilities for creating limited-range non-volatile counting variables that pose a limited strain on the Flash erase-cycle lifeime. But it also means that you *must* erase the Flash page every time there's a possibility that you may need to transition a Flash bit from '0' to '1'.
IIRC erasing a FLASH cell sets it to 0xFF.
Programming then is the process of setting those bits to zero that should be zero. DUring programming no bits are ever set to one. Only an erase does that.
So starting with a freshly erased cell (0xFF) and then programming it with 0xFE, and then without erasing it programming 0xFC we would end up with a cell whose contents is 0xFC, and we think that the erase is not necessary.
Later we do this sequence: Erase, program 0xFE, program 0xFD, but the cell ends up with 0xFC. Huh? Well, the 0xFE cleared the least significant bit, and the 0xFD cleared the second least significant bit, leaving with the two least significant bits cleared, ie. 0xFC.
As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here.
No guarantees, but if we don't report problems they won't get much of a chance to be fixed! Details/discussions at link given just above.
"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]
© 2022 Microchip Technology Inc.