I'm also having problems using the IntEEPROM functions with my MC9S08PT60 MPU.
I've tried contacting Freescale support a week ago regarding it(Service Request "SR 1-2057880684"), but I havent got any response yet...
First I think I've found two errors in the PE generated code:
1. "typedef byte * IEE1_TAddress; /* Type of address to the EEPROM */ "
in the file IEE1.h needs to be a pointer to a word not a byte (since the eeprom address starts at 0x3100)
2. This row in both the functions IEE1_GetByte and IEE1_SetByte seams to be wrong
" if(((word)Addr <...." It should start with "if(((word)*Addr <..... " otherwise it compares the adress of the pointer and not the adress itself.
(It's a little annoying to change this back every time I've regenerated the PE-code, any ideas on how to avoid that?)
But even after fixing these, I still can't write to the eeprom area.
I get the error code "9" (ERR_NOTAVAIL), and when I debug it I can see that it is the function EraseSectorInternal() that is called from the IEE1_SetByte()-function that generates the error code.
I then started to look at the registers, and it gives the errorcode because the bit ACCERR in the status register NVM_FSTAT is set.
I've made a test project to debug it and to highlight the problem:
https://www.dropbox.com/s/0h2tks5ybo2mtpu/eeprom_test.zip
It's written for a TWR-SO8PT60 kit, and requires a serial cable to the computer.
It reads a character that you send from a hyperterminal window (9600,8,N,1,N)
Then the program tries to store it to the eeprom-area
and then retreive it and echo it back to the terminal window together with some debug info.
It also displays the error codes and the status of the NVM_FSTAT register.
The read functions seems to work (it returns "1" all the time, but no error codes)
I get this result in the terminalwindow:
Error code(after eeprom write):09
NVM_FSTAT(after eeprom write): 10100000
Error code(after eeprom read): 00
stored character echoed back: 1
I'm using codewarrior 10.6
I've tried to both enable and disable Memory area 5 in build options for the cpu.
And both exclusive eeprom usage and not for the intEEPROM-component
And both safe and destructive writes.
The MCU:s both in my tower-kit and in the actual prototype I'm working on are of the 4N40C batch btw.
In case this is another bug in the hardware...
Can anyone please help me out?