CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

EEPROM size auto-detect

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Richard Slater



Joined: 08 Sep 2003
Posts: 12
Location: Cambridge, UK

View user's profile Send private message Visit poster's website

EEPROM size auto-detect
PostPosted: Wed Jan 29, 2003 10:04 am     Reply with quote

Hello good people!

Is it possible to auto-detect the size of an EEPROM, such as the 24LCxx range, so I can change (or remove altogether) the type of EEPROM from one PCB to the next, without changing the code?

If it is, a few hints would be appreciated!

Thanks

Richard
___________________________
This message was ported from CCS's old forum
Original Post ID: 11096
kolio
Guest







Re: EEPROM size auto-detect
PostPosted: Thu Jan 30, 2003 3:52 am     Reply with quote

:=Hello good people!
:=
:=Is it possible to auto-detect the size of an EEPROM, such as the 24LCxx range, so I can change (or remove altogether) the type of EEPROM from one PCB to the next, without changing the code?
:=
:=If it is, a few hints would be appreciated!
:=
:=Thanks
:=
:=Richard

Hi,
EE size auto-detect is possible, but will cost some program memory. 24xx family members have different architectures. There are several 24xx.C files in CCS include subfolder. The main differencies are in the comm protocol. 2401-2416 have 1-byte address, while 2432 and above have 2-byte address. You need to make your own read/write routines, where ACK return from i2c_write should be checked. It's good to have control on 24xx WP pin to prevent undesired write operation.
First, read random with 1-byte address protocol. If all the ACKs are issued by 24xx this means you're in the right group. Otherwise, check with 2-byte address.
Second, random write 0xAA and 0x55 to the last assumed address and then verify the value. If the result is negative, ADDR>>1 and try again.
Write test may damage any previously stored info in 24xx, so before write, you can read and store the value and restore it later.
Wish you luck,
Kolio
___________________________
This message was ported from CCS's old forum
Original Post ID: 11133
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group