EEPROM on s12xdp512

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

EEPROM on s12xdp512

2,878 Views
vinay
Contributor I
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
Labels (1)
0 Kudos
6 Replies

658 Views
J2MEJediMaster
Specialist I
There have been a few questions like this recently. Check out this forum thread. The information there might get you started.

---Tom

0 Kudos

658 Views
vinay
Contributor I
Hello,
 
            sorry..I check all the forums related to EEPROM and try to impliment but cant get sucess. while programming some question arrived
1) data sometime strore, some time not why???
2) is there any relation between BDM and EEPROM programming? because while loading program BDM erase all NVM and flash, then how we can retrive EEPROM data second time?
3)how can i check the EEPROM routine without debugging??
 
please help me in this reguard..amd one more que. why processor expert not support xgate??
0 Kudos

658 Views
CrasyCat
Specialist III
Hello
 
Just my 2 cents on that one.
 
According to my understanding you have 2 issues here
  1- You want to keep content of EEPROM as is when you start the debugger. You do not want 
      your EEPROM to be erased.
  Am I right?
  You can use the command AEFSKIPERASING in your preload.cmd file to preserve content of   
   EEPROM when you start a new debug session.
 
  This thread contains additional info on that topic.
 
  2- When you are programming the EEPROM within your application you do not see the EEPROM being changed.
   This might be due to the way the debugging memory map is defined in the debugger.
Please take a look at FAQ-27896 on Freescale web site (www.freescale.com) for information on how to change that.
 
 
  CrasyCat
0 Kudos

658 Views
vinay
Contributor I
Hi crasycat
  Thanks for your valuable suggestion. i wrote the command in preload .cmd file and it works fine ie i can write and read EEPROM. but only single programming it is going to happen ie after write on EEPROM when i reset the controller and want to read a location where i write a variable it cant show, May be  becasuse when i load my .s file to MCU it erase the whole NVM (this i dont want).
 
my steps are
1) i write a variable to EEPROM
 then load this to MCU..run it
2)i read a variable from eeprom
 and retrive data
 then it show me data which i load to laocation of NVM.
 but it cant happen please tell me why? i think when i load .s file to MCU it erase NVM how do i prevent this
 Thanks
vinay
 
0 Kudos

658 Views
CrasyCat
Specialist III
Hello
 
The AEFSKIPERASING command should prevent that.
 
What is the exact command you specified in your preload.cmd file?
 
CrasyCat
0 Kudos

658 Views
ProcessorExpert
Senior Contributor III
Hello all,

Regarding the xgate support in Processor expert, the support of the xgate in the Processor Expert has not been requested from Freescale. So, currently  we dont plan it in near future.

best regards
Vojtech Filip
Processor Expert Support Team
UNIS

www.processorexpert.com

0 Kudos