Shop OBEX P1 Docs P2 Docs Learn Events
Interfacing I2C devices — Parallax Forums

Interfacing I2C devices

agfaagfa Posts: 295
edited 2009-07-05 21:03 in Propeller 1
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

Comments

  • LeonLeon Posts: 7,620
    edited 2009-07-04 13:23
    No.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • agfaagfa Posts: 295
    edited 2009-07-04 13:34
    Thanks Leon
  • LeonLeon Posts: 7,620
    edited 2009-07-04 13:48
    Reading the I2C spec. would be a good idea.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • Nick MuellerNick Mueller Posts: 815
    edited 2009-07-04 14:08
    But two pullups would be good, if you can stand the investment. wink.gif

    Nick

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

    The DIY Digital-Readout for mills, lathes etc.:
    YADRO
  • jazzedjazzed Posts: 11,803
    edited 2009-07-04 14:11
    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://forums.parallax.com/showthread.php?p=788230
  • LeonLeon Posts: 7,620
    edited 2009-07-04 14:56
    NXP has an app note describing a technique using MOSFETs for level conversion.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • agfaagfa Posts: 295
    edited 2009-07-04 14:56
    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
  • agfaagfa Posts: 295
    edited 2009-07-04 15:11
    I'll see if I can find it Leon.· Thanks again.
  • LeonLeon Posts: 7,620
    edited 2009-07-04 15:15
    It's AN10441_1.pdf. It's a bidirectional circuit and meets the I2C spec.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • TimmooreTimmoore Posts: 1,031
    edited 2009-07-04 16:49
    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.
  • LeonLeon Posts: 7,620
    edited 2009-07-04 17:46
    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
  • pjvpjv Posts: 1,903
    edited 2009-07-04 18:00
    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
  • agfaagfa Posts: 295
    edited 2009-07-05 21:03
    Thanks all.
Sign In or Register to comment.