View Full Version : I2C subaddress Question

05-25-2008, 03:30 AM
Hello everyone.

Let me introduce myself.· My name is Andy, and I am becoming a prop-a-holic.

I spent my last Saturday with a new prop·demo board I think its called (the one with the white little proto board) playing around learning spin and writing from scratch a driver for a 8 by 2 line lcd just to learn the basics.· I liked it so much, I ordered a supply of prop proto boards.

I played with I2C years ago, but used a pc printer port, and frankly dont remember much about it.· So I've been reading posts and such freshing up this last week on the topic.· So think I got a basic understanding of how to implement and use it.

Ok heres my question/plea for advise

I wish to use 2 identical I2C devices on the same bus as slaves, with the prop being the third device and the master.· My understanding is that they are going to have the same slave address.· I need to assign each one a unique sub address, which the devices seem to support.
At this point my idea is to hold one in a reset state while assigning the first one a sub address.· Then of course releasing the reset, and issue the second one its sub address, which the first one should ignore.

Any Ideas, or comments, or did I miss anything?

Thanks in advance for any comments, Andy

It also seems as far as pin count goes on the prop side, I could junk the idea connecting the prop chip to the reset lines and just use 2 different I2C busses out the prop chip.· Due to the fact I am exploring the devices themselves, I choose not to go this route, as I may wish to reset them to change operation modes.

Of course the highest priority is pin count at prop side of things, as any remaining pins will be used to communicate out.


Mike Green
05-25-2008, 03:37 AM
Generally I2C devices don't have sub-addresses and the I/O addresses are generally set by some I/O pins which are usually permanently wired for a particular address. The I2C bus master doesn't have an address itself. Look at the datasheet for the particular I2C device you're using for details on addressing.

05-25-2008, 03:53 AM
Hello Mike,

Thank you for your reply.

What I am seeing in the data sheet is

write mode

[Start condition] [7-bit slave address][0][Ack][8 bit sub address][Ack]......

maybe what I am seeing in the 8 bit sub address is really the register address then?

in that case, I see no other option but to have 2 I2C busses.

I think·my problem came from·both a mis-understanding the terminalogy of the data sheet in addition to a mis-understanding of the i2c protocol.

Thank you for your help.

Edit -- additional below

Now I see that first ack must come from somewhere.....ha.· even before the sub address is sent....ding the bell has rung.

05-25-2008, 04:01 AM
The "subaddress" is prob. a register.

What device is this? Can you post link to the datasheet? I've generally seen where most I2C devices let you either A) set the slave address by wiring actual pins on the device high/low, as Mike described, or B) the master needs to send a special command string to the slave device WHEN IT IS THE ONLY DEVICE ON THE BUS to change it's address. The latter I generally see in "micro" based slave devices, i.e., a PIC or the like that's been pre-programmed as an I2C slave. If that is the case with your devices, just socket them on them a single bus -- pop one of them out to set the address. Then pop the other one in (and the first one out) to change it's address. Then you'll be ready w/both on the same bus.

A few devices do not allow you to the change address in any way. If that is really the case here, then yes, you'll need two busses.

Datasheet? Device name?

When the going gets weird, the weird turn pro. -- HST

1uffakind.com/robots/povBitMapBuilder.php (http://1uffakind.com/robots/povBitMapBuilder.php)
1uffakind.com/robots/resistorLadder.php (http://1uffakind.com/robots/resistorLadder.php)

05-25-2008, 04:21 AM
Hello Zoot and thank you for your post.

I wish to control the operating modes of these camera i2c devices.
The image data is a seperate 8 bit bus, the i2c side is for setting of a boat-load of registers.

The data sheet is a 30 page long pdf,·and I dont wish to break anything my first day here.

The devices are TCM8240MD 1300x1040 cameras.

the pdf info has the slave address as

·a6 a5 a4 a3 a2 a1 a0 r/w
·0·· 1·· 1·· 1· 1·· 0·· 1 1/0

7bit slave address.

So I think its pretty much fixed.

btw: I am not planning to try to fit that massive amount of image data from 2 of these in the prop chip.....

EDIT: --add

the pdf is hosted on sparkfun site....just google·tcm8240md.pdf if your eyes widen and have to look....

Post Edited (Burritoe) : 5/24/2008 9:27:11 PM GMT

Mike Green
05-25-2008, 04:57 AM
With a device like this (a camera), a single fixed address makes sense (except for your situation). You'll need to use two separate I2C busses.

05-25-2008, 05:22 AM
Hi Burritoe

[8 bit sub address] = Register Address to Read/Write

Nothing is impossible, there are only different degrees of difficulty.


05-25-2008, 08:38 AM
Cool camera. And low voltage supply to go w/the Prop. Nice.

Full datasheet: www.sparkfun.com/datasheets/Sensors/Imaging/TCM8240MD.pdf (http://www.sparkfun.com/datasheets/Sensors/Imaging/TCM8240MD.pdf)

P.S. -- "7bit slave address" -- generally all I2C devices (with normal addressing) have 7bit addresses, with the lowest bit reserved for letting the device know if the operation is to be a write or a read. So an address of 0xA0 is the same device as 0xA1; 0xB8 is the same device as 0xB9, etc. In short, I2C addresses are generally even numbers...

When the going gets weird, the weird turn pro. -- HST

1uffakind.com/robots/povBitMapBuilder.php (http://1uffakind.com/robots/povBitMapBuilder.php)
1uffakind.com/robots/resistorLadder.php (http://1uffakind.com/robots/resistorLadder.php)

Post Edited (Zoot) : 5/25/2008 1:44:19 AM GMT