|
|
View previous topic :: View next topic |
Author |
Message |
Richard Slater
Joined: 08 Sep 2003 Posts: 12 Location: Cambridge, UK
|
EEPROM size auto-detect |
Posted: Wed Jan 29, 2003 10:04 am |
|
|
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 |
Posted: Thu Jan 30, 2003 3:52 am |
|
|
:=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 |
|
|
|
|
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
|