PDA

View Full Version : Open-collector VS bipolar lines on I2C devices



Demon
- 19th November 2005, 16:57
Hi,

The manual mentions that the Clock and Data lines for I2C devices can be made either open-collector or bipolar. Open-collector requires a 4.7K pull-up resistor on the Clock and Data lines, and bipolar requires DEFINE I2C_SCLOUT 1.

What is the difference between each option?

Is there a performance difference?

Can you mix open-collector and bipolar on the same mcu?

Robert
:)

Dave
- 19th November 2005, 17:24
Demon, If you use bipolar drive then the acknowlege bit sent from the slave component on the bus will be driving onto an active output, It really needs to be an open collector drive as the master w/pullups to be compatable with the I2C bus specification. As far as I know this option was put into place for devices that do not send an acknownege bit which there are few.

Dave Purola,
N8NTA

Demon
- 19th November 2005, 18:50
Ah! Thanks Dave!

So, what happens when you have more than 1 I2C device?

Do you have only one pair of pull-ups on the mcu, or one pair on each device?

Robert
:)

Dave
- 19th November 2005, 22:56
Demon, Thats the beauty of an open collector buses is there can be an unlimited number of devices connected. Any device can respond to a command and any device can be the master. Over current collisions are avoided by there only being 1 set of pullup resistors that source the current to the bus. If 2 devices try to talk at the same time there is no excessive current drawn. Therefore there needs to be a standard protocol that is used in the communications scheme. I have had more than 32 devices on a single bus in the past without any problem. The resistors are sized by the time constant to clear the ground condition produced by the device that is talking on the bus. Therefore to talk at higher speeds the pullups need to be smaller in size to enable more source current to the bus to clear the ground condition.

Dave Purola,
N8NTA

Demon
- 19th November 2005, 22:58
Okaaaay...

So that begs the question, how do we calculate the resistor size?

The manual says 4.7K resistors, but I suspect that is an 'average'.

Robert
:)

Dave
- 19th November 2005, 23:14
Demon, What you need to do is use an oscilloscope and look at the SDA line as well as the SCK line. However the SDA line is of more importance due to the fact that any device on the bus can drive it. Usually there is only 1 master and it generates the clock for the slaves. With the maxumum devices on the bus and the longest bus lines, opertaing at your maximum speed, make sure that the SCL and SDA lines are not distorting the waveform. If the waveform is rounded then decrease the resistance in 100 ohm increments until the waveform edges look pretty square. Be carefull not to go below about 1K ohm as that would be 5 ma. of current draw. Some devices out there can't pull down much mode than that.

Dave Purola,
N8NTA