AnsweredAssumed Answered

AN3961: EEPROM-in-D-Flash Emulation for the S12P

Question asked by Vladimir Gusiatnikov on Dec 26, 2013
Latest reply on Apr 2, 2018 by asish mondal

A heads-up to anyone who may be inclined to use the code package supplied with Application Note 3961 and provided at


that the package won't work for the S12P. The package ignores the difference between global and local (or logical) addressing on the S12P family; the S12P does not understand or use global addressing other than in its Flash Technology Module. In order to program D-Flash on the S12P, one needs to use a global address, and to read it, a different local (or logical) address (see also confuse in memory map of mc9s12p128.), but the code for AN3961 uses the same (global) address to read and program.


It appears that the AN3961 code package is a side fork of the main Freescale EEPROM emulation driver for 0.18 µm SGF Flash. I do not know whether the main driver works on the S12P.


There is also a much more compact EEPROM-in-D-Flash driver written by Gordon Doughman and described in Application Note 4483. It is based on the same concept as AN3961, but does away with the ability of having multiple emulated-EEPROM blocks within one D-Flash sector, and the writes are interrupt-driven. This driver takes into account the offset between the global and the local addresses, and works on the S12P.