On Tue, Dec 20, 2011 at 7:49 PM, imato <cooper.zp@...> wrote:
> Hi Dave,
> Thanks for your reply.
> The address of 24LC01B is 1010xxxx, but 0x50 is 01010xxx. I think they are
> not the same.
You're confusing the first byte with the address. The address is only
7-bits long and happens to be in the upper 7-bits of the first byte.
So the full byte would be:
1010xxxD where D is the direction bit. The address portion is 1010xxx,
or if I replace the x's with 0's then you get 0101000 or 0x50 (another
hint is addresses need to be in the range of 0 thru 127 or 0x00 thru
0x7f. You'll notice that i2c-detect only outputs addresses that go
upto 0x7f for exactly this reason (yeah it actually stops at 0x77,
because 0x78 inidcates 10-bit addressing and the remaining values are
reserved for future use - See Section 5.2 of the SMBus 2.0
10100000 is 0xA0 which is too big to be an address.
This messes up many people who start out with i2c (and is probably the
most common problem).
> I disconnected the 24LC01B chip from my circuit, and ran $ i2cdetect -y -r
> 3, I still can get 0x50 address.
That's the internal EEPROM. If you have 2 devices on the bus with the
same address everything still works until you try to read from the
devices and they return different values. Since the bus is open
collector, whoever delivers a zero bit wins.
Shuswap, BC, Canada