I have a project using the MC9S12A64, and would like to use the EEPROM. Problems:
There are two very different and contradictory explanations on how it works, one in the processor user guide, and one in the EEPROM user guide. One claims that you write the desired data directly to the desired address, then write to a register to start the write. The other claims that you write the data to one register, the address to another, then write to a third to start the conversion. I have tried both ways, neither one is working.
There is no sample code in either CodeWarrior 5.1 or Processor Expert. CodeWarrior 10.x doesn't support this processor.
I created a sample program that only erases the EEPROM and writes to a few locations. This code compiles, but won't execute. The debugger complains that I am accessing unimplemented memory in the form of the EEPROM status register at its default location of 0x0115.
There are no sample programs on either SourceForge or GitHub or any other place I can find.
Despite all of that, I wrote a program that:
moves the EEPROM to 0x800 and turns it on (INITEE = 0x0b),
sets the clock speed (14.745MHz divided by 80 = 184kHz),
erases the array,
and programs fixed values into the first few locations.
The erasure is working. The write code hangs up while waiting for the status flag bit CCIF to set. It never does. Examining the register set, no status flags are ever set, including BLANK, even though displaying the memory clearly shows it is blank. This lends credence to the debugger saying it is unimplemented. If so, where is it? All the other registers are in their default locations. (RAM is at 0x1000, EEPROM at 0x800, registers at zero).
So my first question is, has anyone ever gotten this thing to work? Second question, how?