PDA

View Full Version : Interfacing I2C devices



agfa
07-04-2009, 08:40 PM
I'm going to be playing around with some·I2C devices.· Do I need a current limiting resistor on the SDA line to protect the prop or the device incase of a conflict?

agfa

Leon
07-04-2009, 09:23 PM
No.

Leon

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle

agfa
07-04-2009, 09:34 PM
Thanks Leon

Leon
07-04-2009, 09:48 PM
Reading the I2C spec. would be a good idea.

Leon

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle

Nick Mueller
07-04-2009, 10:08 PM
But two pullups would be good, if you can stand the investment. http://forums.parallax.com/images/smilies/wink.gif

Nick

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!

The DIY Digital-Readout for mills, lathes etc.:
YADRO (http://www.yadro.de)

jazzed
07-04-2009, 10:11 PM
If it's a 5V device where the device output is > 3.3V, a resistor between the device output and propeller input should be used. A series resistor value should be selected based on the voltage drop across the resistor that will produce no more than 0.5ma. If device output voltage is Voh, then R >= (Voh - 3.3) / 0.0005. YMMV.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve


Propalyzer: Propeller PC Logic Analyzer (http://www.brouhaha.com/~sdenson/Propalyzer)
http://forums.parallax.com/showthread.php?p=788230 (http://forums.parallax.com/showthread.php?p=788230)

Leon
07-04-2009, 10:56 PM
NXP has an app note describing a technique using MOSFETs for level conversion.

Leon

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle

agfa
07-04-2009, 10:56 PM
Yes Leon.

Thanks Nick, thanks Steve

edit:

looking at the phillips I2C specs v 2.1 it shows devices of different·voltage suplies tied·directly to the bus.· I didn't see any thing about considerations of tying the bus·to a microcontroller.· I will continue reading.


Post Edited (agfa) : 7/4/2009 3:12:49 PM GMT

agfa
07-04-2009, 11:11 PM
I'll see if I can find it Leon.· Thanks again.

Leon
07-04-2009, 11:15 PM
It's AN10441_1.pdf. It's a bidirectional circuit and meets the I2C spec.

Leon

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle

Timmoore
07-05-2009, 12:49 AM
My experience has been for small number of 5V i2c devices a pullup (4.7K-10K) to 3.3V on the prop pins for sda,scl, then 1K inline resistors for the sda/scl works.
For a lot of I2C devices > 10 you may be better with the mosfet interface, if you want to prototype or dont want to build it, I have used both i2c level shifter devices and the sparkfun http://www.sparkfun.com/commerce/product_info.php?products_id=8745 board.

Leon
07-05-2009, 01:46 AM
I think you've been lucky. Vih for 5V CMOS I2C devices is typically 3.5V minimum.

Leon

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle

Post Edited (Leon) : 7/4/2009 5:52:32 PM GMT

pjv
07-05-2009, 02:00 AM
Hi All;

Actually, it is not a bad idea. One time I had a bear of a time finding a bug in my software that occasionally·caused a conflict, and it was sufficient to pull the power supply low enough for a couple of microseconds·to cause a RESET. Of course this is not supposed to happen but during debugging it has proven that it can.

My experience is that a series resistor on the SDA line -I use 100 ohms- works just fine, and then you also dont have to turn the processor's port bit to an input when the I2C device sends an acknowledge and you are happy to ignore that acknowledge.

Cheers,

Peter (pjv)

Post Edited (pjv) : 7/4/2009 6:07:03 PM GMT

agfa
07-06-2009, 05:03 AM
Thanks all.