Shop OBEX P1 Docs P2 Docs Learn Events
Help with I2C circuit — Parallax Forums

Help with I2C circuit

mynet43mynet43 Posts: 644
edited 2008-01-22 20:02 in Propeller 1
I have a propeller circuit which is designed to drive two I2C devices:
1. The usual EEPROM AT24C512.
2. A TI Stereo Codec: TLV320AIC3101.

The SCL and SDA lines are tied together on the two devices.
I have both the SCL and SDA lines pulled up to 3.3V with 10K resistors.

The propeller seems to work fine when I download a program to memory and run it. VGA etc. work fine.

The problem is when I try to download to EEPROM, either it gets an error loading to the EEPROM or it appears to load but fails to run from the EEPROM when I do a reset or power cycle. Almost like it's marginal.

Does anyone have experience with this kind of situation?
Is it possible I should lower the pull-up resistance when I have multiple devices? E.g. 5K instead of 10K pull ups?

Any help would be appreciated.

Jim

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-01-16 01:38
    I would try a lower pullup, something more like 4.7K. Make sure you've got adequate power distribution with good bypassing of the EEPROM and the codec and its multiple supply voltages.
  • RaymanRayman Posts: 14,162
    edited 2008-01-16 02:11
    Does it work without the TLV320AIC3101? As Mike suggests... Programming the EEPROM seems to take a lot of power... Make sure you have a Vdd-to-ground capacitor close to the eeprom...
  • mynet43mynet43 Posts: 644
    edited 2008-01-16 02:18
    Thanks Mike, I'll try it.

    I think the power distribution is OK, I have a separate 1.8V regulator for the DVDD line. The others are all driven by the 3.3V rail.

    Jim
  • mynet43mynet43 Posts: 644
    edited 2008-01-16 02:24
    @ Rayman,

    It's difficult to remove the TI chip, since both it and the Propeller are QFN devices on the circuit board. I can unsolder it but that's kind of a pain with QFN chips (no pins sticking out). And very difficult to resolder [noparse]:)[/noparse]

    I may have to do that if Mike's suggestion doesn't work.

    Jim
  • mynet43mynet43 Posts: 644
    edited 2008-01-16 03:04
    Hey Mike! It worked!

    I didn't have any 4.7K resistors so I just soldered 10K SM resistors on top of the existing ones to give my two 10K in parallel, which is 5K pull-up for each I2C line.

    When I powered it up, it started running, meaning that the last time I programmed the EEPROM it worked but just couldn't load it back into the memory. Interesting.

    Seems to be solid now.

    Thanks!

    Jim
  • deSilvadeSilva Posts: 2,967
    edited 2008-01-16 09:24
    Adding devices to the I2C bus increases the capacitance, three devices (Prop, EEPROM, amplifier) can make upto 20pF. When the lines are only driven low (by the devices), it will take some R*20 psec = 200 nsec for the edges to rise. This should become a problem with 1MHz transmission, though not yet at 100kHz....
  • mynet43mynet43 Posts: 644
    edited 2008-01-16 15:00
    deSilva,

    Are you aware of some guideline or rule for estimating the required pull-up resistance when adding more devices to the I2C buss? The 5K seemed to work fine this time but it's very frustrating to end up with a marginal circuit... I can see where the capacitance would also increase as a function of the trace length and spacing and device type.

    Thanks for the help.

    Jim
  • Paul BakerPaul Baker Posts: 6,351
    edited 2008-01-16 18:58
    If you do search I2C and pullup, you'll pull up references which state the prefered pullup value for I2C is 4.7kΩ as Mike stated.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • deSilvadeSilva Posts: 2,967
    edited 2008-01-16 19:11
    I don't like unexplained figures from authorities. I always question them!
    Here www.i2c-bus.org/Termination-versus-Capacitance.530.0.html are diagram's showing the relationships more graphically. It seems that 4k7 is recommended for the worst case 400pF , @100kHz. The overall capacitance in the system of the OP should be 1/10 of this. Thus a 47k pullup should suffice, a 10k should do well.

    I am not very happy that is now works. I do not understand why it should in the first place!
  • mynet43mynet43 Posts: 644
    edited 2008-01-17 03:55
    @ Paul,

    The Prop Demo board uses a 10K pull-up, which seems to work fine. I've used this on several Prop boards I've designed that have only one I2C device (24LCXXX) and they always seem to work fine. When I added another device, the I2C became marginal and wouldn't work for the EEPROM. When I reduced the pull-up to 5K, everything worked and became solid. It appears to be related to the number of devices (or total capacitance?). Any thoughts?

    @ deSilva,

    I liked your link. I used it to find the attached charts in the I2C spec. They show the max and min pull-up values. These seem to make sense. What do you think?

    Jim
  • deSilvadeSilva Posts: 2,967
    edited 2008-01-17 18:54
    The diagrams are about as expected. 10k should work upto 80 pF. The input capacitance for SCL and SDA is given as 6 to 8 pF for standard I2Cdevices in datasheets, so you should not run into trouble before you connect 10 of them or so...
  • Paul BakerPaul Baker Posts: 6,351
    edited 2008-01-17 20:19
    We haven't seen his setup, it is very easy to start collecting puffs very quickly, especially if it is breadboarded. Each row on a breadboard which is connected to an electrical node can contribute upto 25 pF, and we know that he has at least 3 rows attached to the node (meaning upto 75 pF), then adding the input capacitance of two devices (one is driving the line and doesn't contribute), you are looking at a maximum stray capacitance of 90 pF. There is also stray inductance associated with each row which also limits the top speed of the channel.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • deSilvadeSilva Posts: 2,967
    edited 2008-01-18 01:18
    mynet said...
    It's difficult to remove the TI chip, since both it and the Propeller are QFN devices on the circuit board. I can unsolder it but that's kind of a pain with QFN chips (no pins sticking out). And very difficult to resolder [noparse]:)[/noparse] ...
    As the application-frequency as such is relativly low (<100kHz), we just have the slow rise of the edges. The propeller as receiver shouldn't care so much.... The funny thing is, that the EEPROM seemed programmable, but not re-readable, and this is the less critical direction...

    I am not happy that all this should work with 4k7 and not with 10k....
  • mynet43mynet43 Posts: 644
    edited 2008-01-18 16:04
    To clarify the setup. It is not a breadboard. It is a circuit board with both the Prop and the TI chip as QFN devices mounted about 1/4" from each other. The EEPROM is located on the opposite side of the Prop about 3/8" from the Prop.

    The traces are not optimally routed, so they are probably about 2" long. This may account for the added capacitance. When I mod the board, I'll try to minimize the trace length for the I2C.

    Right now it's running OK with 5K pull-ups, I can talk to both I2C devices. However, I'll probably lower the pull-up values just to make sure.

    Jim
    2560 x 1920 - 2M
    2560 x 1920 - 2M
  • Paul BakerPaul Baker Posts: 6,351
    edited 2008-01-18 18:11
    Jim, do you happen to have a capacitance meter? It would be nice to test the SCL and SDA line to see what thier actual capacitance is, it shouldn't be very high unless there is some problem with the board.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • mynet43mynet43 Posts: 644
    edited 2008-01-18 19:54
    Paul,

    All I have is a cheap capacitance meter.

    With that, I measure about 80nF to ground on both lines (SCL/SDA). This seems about 1000 times too large!

    If it's really that high, I don't see how it would work at all. I can't see anything wrong with the traces on a bare board.

    It seems to be working fine with the 5K pull-ups.

    Sorry I couldn't get you better data. Let me know if you think of anything.

    Thanks,

    Jim
  • Paul BakerPaul Baker Posts: 6,351
    edited 2008-01-18 20:14
    That is an unusually high number, I don't know if the resolution of your meter is coming into play (IOW your capacitance meter wasn't designed to measure very low capacitance), or there's something up with your design. I noticed your TI part is a QFN package, but it looks like your board is hand soldered, did you solder the ground pad of the chip to the board? Also I'm having trouble figuring out where your eeprom is, can you point out where it is?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2008-01-18 21:32
    Paul, I think it's at 11 o'clock relative to the prop in the first jpg.
  • mynet43mynet43 Posts: 644
    edited 2008-01-18 21:32
    Paul,

    Thanks for the feedback. The eeprom is located on the BoardTop picture at the top of the board to the left of the Prop. It's an 8 pin SM part.

    Good point about the ground pad of the TI chip. I did put solder paste on the ground pad before I soldered it, which should have worked, since the whole board was heated. If you look on the back of the board, you can see four holes thru the board on the back of the TI chip. In looking thru these, it doesn't look like there's much solder there. The good news is that I can solder it thru those holes. I'll try it and let you know if it helps.

    The chip does have a digital core / I/O ground (pin 6, DVSS) which is tied to ground. I just noticed that the spec says to connect the thermal pad to DRVSS, the analog output driver ground. I think I probably missed this. Do you think this could cause the problem? I'll connect it and see what happens. Right now it's not connected to anything.

    Thanks for your help.

    Jim
  • Paul BakerPaul Baker Posts: 6,351
    edited 2008-01-18 21:58
    I wouldn't worry too much about the ground plane, it's more of a shot in the dark, and I don't think it's whats causing problems. I was under the impression that the TI chip is on the same I2C bus as the eeprom, but it doesn't appear to be the case, can you confirm. Do you have a schematic we can look at to see if theres anything up with the design itself?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • mynet43mynet43 Posts: 644
    edited 2008-01-18 22:15
    I made the two changes I talked about, soldering the heat sink and connecting it to ground.

    These didn't help. The board still works and I still measure about 80nF on the two lines [noparse]:([/noparse]

    Here's the schematic. It's basically designed to be an evaluation board for the TI chip running with the Prop but it also has the Prop sound circuit included. Configuration of devices and mic/headphone I/O is handled by jumpers.

    FYI, the EEPROM and the TI chip ARE on the same I2C bus.

    Here's the schematic. Thanks so much for your help.

    Jim
    2981 x 2152 - 1M
  • Paul BakerPaul Baker Posts: 6,351
    edited 2008-01-18 23:54
    Ok, the design seems to check out. I have measured the capacitance of the demo board's sda and scl lines (110 pF and 80pF respectively), and I'm starting to think we should stop tinkering with your board (especially since it works). The traces on the demo board are 0.1" long, and your design has them traveling what appear to be inches, so I'm thinking your reading is to be expected given your layout.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • mynet43mynet43 Posts: 644
    edited 2008-01-19 00:16
    Thanks Paul, I agree. Lets leave it at that for now.

    I think I'll lower the pull-ups to 2.2K to provide a little margin of safety.

    Jim
  • mynet43mynet43 Posts: 644
    edited 2008-01-19 01:32
    One final observation for all of you I2C fans.

    I replaced the 5K I2C pull-ups with 2.2K resistors. When I did this, I immediately started getting EEPROM programming errors and intermittent results. In fact, when it did run, it couldn't always find the TI chip with I2C.

    When I replaced the 2.2K with 3.3K resistors, everything started working fine and seems solid.

    Food for thought. Don't go too low with the pull-up resistors...

    Jim

    P.S. Paul, I think you're right about the capacitance on my board, it's really high. Anyone laying out a board with I2C devices should be careful to minimize the I2C trace lengths.
  • TomSTomS Posts: 128
    edited 2008-01-19 14:00
    IMO There is no way the capacitance could be above a hundred picofarads with the layout given, he's not even using a ground plane (or does the pcb have more than two layers?). I suspect coupling problems when higher pullup resistor values are used. The problem with it not working when the pullup resistors were decreased could be because one of the devices can't handle that low a value.

    Tom
  • deSilvadeSilva Posts: 2,967
    edited 2008-01-22 20:02
    How fast those threads pass away...
    Well, I did a lot of scoping the last weekend...
    The small PASM I2C driver is now running!

    Two I2C devices on a very unclean solderless breadboard, 10k pull-up.

    There was a rise time of SDA of 3 µs (3µs/10k = 300pF) The (driven) SCL was fine! I increased the clock to 200 kHz (marginaly for that rise time), and the port expander chip I was addressing still worked fine (though specified to 100kHz only). Changing the pull-up to 4k7 reduced the rise time of SDA to 1.5µs as expected, without any good or bad influence.

    The funny thing is this above 100pF .. this is MUCH more than I would have expected. I shall test with some more chips....
Sign In or Register to comment.