I'm using SAM4E and trying to emulate an EEPROM using flash_efc.c/.h drivers. The idea, as described in AN 42218, is to use partial programming feature of the flash to incrementally write new data. Basically, a sector/page is initialized (all 1s) and new data is written incrementing the offset into that sector/page. In other words, the sector/page is erased once and written multiple times with new data (overwriting areas with all 1s).
The issue I have is, in some cases, it seems it can't write some bits as 0 (staying as 1), so it changes my data. I tested including an erase every time it writes a new set of data, and it works fine, but of course this is not the idea behind the EEPROM emulation. I'm using the ASF drivers so I don't think I'm doing anything wrong on my side.
I would appreciate any help.