View previous topic :: View next topic |
Author |
Message |
theteaman
Joined: 04 Aug 2006 Posts: 98
|
I2C and pullups |
Posted: Wed Jan 11, 2012 4:06 am |
|
|
Hi
I'm using an 18F4550 at 3.3V with I2C comms to an IC.
My pull-up resistors are 4.7k.
I2C is playing up. When the IC sends data in small batches everything is fine, but when it sends lots of data, some of the data is not received/ wrong.
Could the reason be that my pull-up resistors are the wrong value?
Thanks. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19546
|
|
Posted: Wed Jan 11, 2012 4:46 am |
|
|
Yes, possibly.
However I also have to point out that the 18F4550, is _not_ rated to run at 3.3v. The 18LF4550 is (Up to about 18.5MHz).
Are you _sure_ this is OK.....
'Possibly', because teh answer depends on your bus. It's speed, and it's total capacitance.
As I2C voltage goes down, so does the value of pullup required, for a given bus capacitance.
The formulae for the resistors are:
Rp(max) = tr/(0.8473*Cb)
where tr is the bus rise time, and Cb is the bus capacitance.
tr for a fast mode bus is 300E-9sec
Rp(min) = Vdd-Vol/Iol
Where Vdd is the supply, and Vol, the low output voltage level, and Iol the pull down current
Iol is normally 3mA, and Vol 0.66v with 3.3v supply.
Assuming a bus that is reasonably short, allow perhaps 100pF for Cb, these then give:
Rp(max) = 3540R
Rp(min) = (3.3-0.66)/3E-3 = 880R
So, unless you bus capacitance is below perhaps 60pF, you are above the maximum pull up value recommended for 3.3v operation at fast mode.
Best Wishes |
|
|
theteaman
Joined: 04 Aug 2006 Posts: 98
|
|
Posted: Wed Jan 11, 2012 5:36 pm |
|
|
Thanks Ttelmah, this information is very valuable to me! Appreciated. |
|
|
Brandon03
Joined: 11 Jan 2012 Posts: 3
|
|
Posted: Thu Jan 12, 2012 12:13 am |
|
|
As you have seen already by yourself, pullup resistors are vital for the i2c bus, both in the sda and scl lines. It is usually obvious that the sda line is bidirectional, what is not so obvious is that the scl is also somewhat bidirectional, since slaves can maintain the line low to throttle down the speed of the bus.
In many cases the bus can become locked because of a collision or other physical problem like loosing your pullups, in such a case, some slaves don't release the bus properly because they understand that they are still being addressed. This situation can be fixed by the master sending output SCL pulses and finally a stop condition when the lines are released. However if you say that there are no slaves, this probably is not your case.
I'm afraid that your problem might have to do with the master's i2c peripheral not seeing the lines go high when expected because the pullups are disconnected temporarily. The best solution I can think in your case is that you should make sure that you don't loose those pull ups. The best way to achieve this is to connect two or three resistors in parallel in each line, this way all two/three would have to be disconnected to leave the bus "unpulled". Use two 10k resistors in parallel for SDA and another two for SCL. |
|
|
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Thu Jan 12, 2012 9:50 am |
|
|
Whenever I use an I2C bus I like to use something like the LTC1694-1 bus accelerator. This helps straighten the edges of the signals and helps the voltage levels reach the proper state quicker.
Ronald |
|
|
|