problem in Reading the internel eeprom in xep100 evaluation board

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

problem in Reading the internel eeprom in xep100 evaluation board

1,643 Views
admin
Specialist II

hi,

i have developed the application that must read the data from the internal eeprom.In a new board no data will be availabe so for the first i will write the some default data in to eeprom using Write Function(Below Specified Function). and  Restart the board. 

when the board gets booted for the second time my application must read data from the same location and have to update my global structure.

i am facing the problem in reading the data from the internal eeprom when the board gets loaded for the second time. its not reading the availabe data. some junk value is read.

 

note:

if i do the read operation after wirte operation its working fine.

if i do only read operation its not reading the data. but data is there in eeprom. i checked with datablaze programmer.

 

following are my function

static byte Eeprom_Write_Word(TAddress AddrRow,word Data16) {

if (FSTAT_CCIF == 0) {

return ERROR;

}

 

FSTAT = 48;

FCCOBIX = 0;

FCCOBHI = 17;

FCCOBLO = (byte)(((dword)AddrRow) >> 16);

FCCOBIX++;

FCCOB = (word)((dword)AddrRow);

FCCOBIX++;

FCCOB = Data16;

FSTAT = 128;

if ((FSTAT_FPVIOL == 1) || (FSTAT_ACCERR == 1)) {

return ERROR;

}

while (!FSTAT_CCIF) {}

if (FSTAT_MGSTAT) {

return ERROR;

}

return SUCCESS;

}

static byte Eeprom_Read_Word(TAddress Addr,word *Data) {

if((Addr < EEPROM_AREA_START) || (Addr > EEPROM_AREA_END)) {

return ERROR;

}

 

if(!FSTAT_CCIF) {

return ERROR;

}

*Data = *Addr;

return SUCCESS;

}

 

i want to know there is any command for reading the internal eeprom. please help me to get out of the problem.

Labels (1)
0 Kudos
2 Replies

248 Views
jsmcortina
Contributor III

There are two ways to read from the EEPROM.

First is to set the EEPROM page you want and then read from the EEPROM window.

e.g. EPAGE = 0x00;

Then read from the window at 0x800-0xBFF

 

Second is to use the global read commands.

The EEPROM/D-flash is at addresses 0x10_0000 - 0x10_7FFFF

e.g.

movb #0x00, EPAGE

gldd 0x0000

 

I use gcc as compiler as it is not aware of the global addressing, so I have to use assembler to do the second method.

 

Be sure to initialise FCLCKDIV after each boot or the EEPROM won't be writeable.

 

James

0 Kudos

248 Views
admin
Specialist II
thanks james...
0 Kudos