Shop OBEX P1 Docs P2 Docs Learn Events
I2C reading problems: multiple addresses — Parallax Forums

I2C reading problems: multiple addresses

Chuck MintonChuck Minton Posts: 45
edited 2011-03-12 11:43 in Propeller 1
Please disregard this post... I mistakenly posted it to general post also..

My bad~

I am trying to read the 4 possible temp readings from an LM92 2 bit address.

Does anyone have any experience with stretching the clock on and I2C buss.

Any suggestions welcomed... I know the I2C buss is not designed to run on long wires. but plenty of success has been proven it can be done by streching the signal out.

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-03-11 12:40
    You may be getting extra clock pulses due to cable reflections. Which conductors in the cable are you using, and for which signals/power? Where are your pullup resistors?

    -Phil
  • Chuck MintonChuck Minton Posts: 45
    edited 2011-03-11 20:17
    Reading multiple i2c sensors

    I am trying to read the 4 possible temp readings from LM92's (2 bit address).
    All of the sensors I have send back their data correctly.
    All the positions can read the temp data correctly.
    I can read 3 of the 4 sensors when all the sensors are connected.
    Usually the last sensor T4 has a reading issue. Sometimes the T3 has an issue. Usually T4 is not recognized as not present. On occasion I get erroneous data back.
    I am running these on Cat 5 wire for placement.
    originally I thought It was the length of wire I was using.. To challenge this I put an entire 100 feet on a sensor and I can read the temp on 100' of CAT5!
    I can read the temp on short lengths like on only 4" of the same.
    I have both clk and data 2K pullup resistors.

    The problem is obscure in that if I if I un-plug one of the three that are reading then I can read the last one,t4.
    I thought it might need more capacitor decoupling at the sensor.. .1& 1 uF across Vcc & gnd. and .1uF across each address to gnd.

    I was reading in the documentation that came with these and it said that these could be read at hundreds of feet if the clocking was slowed down.

    ON one hand I am thinking the length of wire might have something to do with it but why could I read the 100' one and not be able to read a 4" long run just because of the physical location on the board or the sequence in which they are read. They are all read from T1 to T4 sequentially, with multiple lines of conditional code between each read.

    I tried putting waits between each read request. That did not help anything.

    Does anyone have any experience with stretching the clock on and I2C buss and able to explain to me the theory and detail about implementation.

    Also any ideas on how to access or "read" the actual bits going and coming and how thy line up.

    I am using a 16bitread modified I2C SPIN Object by James Burrows May 2006 Version 1.3

    Any suggestions welcomed... I know the I2C buss is not designed to run on long wires. I have read of success after slowing things down.

    I would appreciate all comments.
    Thanks, Chuck
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-03-11 20:32
    Chuck,

    You have posted this same issue in one other thread -- possibly two other threads. This is what is called "cross-posting" and is frowned upon in the forum. You won't get more help by starting more threads. Please try to confine your topic to a single thread so that all the pertinent information is contained in one place.

    -Phil
  • Chuck MintonChuck Minton Posts: 45
    edited 2011-03-11 20:41
    Yes Very Sorry about That. I got to thinking no body would be looking there after several hours ... Won't do that any more.
    Is there a way to remove one of them???
  • Chuck MintonChuck Minton Posts: 45
    edited 2011-03-11 20:58
    Hi Phill,
    Ok,

    The pin out are as follows:

    Green:Clk , Green/White: T Critical ( un-used and pulled up via 10K)
    Orange: Data , Orange/White: T Alarm (un-used and pulled up via 10K)
    Blue: Gnd , Blue/White : pin 6, lsb address
    Brown: pin 7 msb address , Brown/White Vcc3.3v

    I started with 10K pullups but the length of wire worked better at 2K.

    I have tried 200ohm but this did nothing.

    The Different sequences of the long wires vs the short wires is non-consequential. T4 has the most problem, but it is closest to the pull ups, and closest to the prop.

    The lit said distances would work better if I could slow down the or " stretch" the clock cycle, but I don't know if that is the problem since it works on the long wire.

    What do you think about placing a resistor in series with the Clk and Data on each run to dissipate reflected currents???

    Actuall... thinking about it There seems to be more trouble with the shorter ones than the longer ones. If I place the 2 shorter ones on T2 and T3, when I plug in a long T4 the error occurs on one of the shorter temp sensors.

    The lengths are:
    4"
    4'
    20'
    100'

    /Chuck
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-03-11 21:52
    I would try an RC snubber in parallel with the pullups. (BTW, I would put the SCL pullup, if you have one, at the far end of the cable, and divide the SDA pullup between the two ends.) The snubber would consist of a 100-ohm resistor in series with a 0.01uF (or smaller -- experiment) cap. This will provide AC termination at the cable's natural impedance without adding a heavy DC load to the signal lines. Your series resistor idea also has merit in that, combined with the cable's capacitance, it will limit the signal slew rates, which also mitigates disruptive reflections. I hope you have an oscilloscope that you can use to quantify the results obtained from these various approaches. Otherwise, we're just shooting in the dark.

    -Phil
  • kwinnkwinn Posts: 8,697
    edited 2011-03-12 11:28
    Chuck, CAT5/6 cable has an impedance of ~100-120 ohms so the first thing I would suggest is putting a 100-120 ohm resistor at the beginning and end of the cable. One possible reason it works better when you remove a unit is that it changes the loading on the cable. That change may be enough to make reflected signals look like valid ones, or for the reflected signal to cancel a valid one.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-03-12 11:43
    kwinn,

    It's not clear from your suggestion whether the resistors should be in series or terminated to Vdd or ground. The latter won't work, unfortunately, since I2C devices do not have sufficient drive. That's why I suggested putting the 100-ohm resistor in series with a small cap, thus creating an AC impedance-matching termination that doesn't affect the DC load.

    -Phil
Sign In or Register to comment.