Hello ,
i am working on s12xdp512 MCU on codewarrior platform, i want to implemented EEPROM ie read,write,erase application on it. my OSCr frequecny is 4Mhz, and bus clk is 20Mhz using PLL.
i config and write the routines like below
void EEP_init(void){
ECLKDIV=0x14; //for 4mhz oscr and 20mhz busclk
ESTAT=ESTAT | (ESTAT_PVIOL_MASK|ESTAT_ACCERR_MASK);
}
void writ_eep_word(){
while(!ESTAT_CBEIF);
ESTAT = (FSTAT_ACCERR_MASK | FSTAT_PVIOL_MASK);
(*(unsigned int *)address=data; // Store desired data to address being programmed
ECMD = 0x20; // Store programming command in FCMD
ESTAT_CBEIF = 1;
/ while(ESTAT_CBEIF==0);
void get_data_eep(void)
{
while(!ESTAT_CCIF); // ready?
gdata=(unsigned int *)address;
}
i write my data to adrees 0xc000 which is given range of EEPROM, in prmfile. here i only write single word but i cant get sucess.
i)where am i rong (anything rong with code")??
ii)how to write a sequencial data to sequencial adresses??
plz help
vinay