CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

I2C and pullups

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
theteaman



Joined: 04 Aug 2006
Posts: 98

View user's profile Send private message

I2C and pullups
PostPosted: Wed Jan 11, 2012 4:06 am     Reply with quote

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: 19545

View user's profile Send private message

PostPosted: Wed Jan 11, 2012 4:46 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Jan 11, 2012 5:36 pm     Reply with quote

Thanks Ttelmah, this information is very valuable to me! Smile Appreciated.
Brandon03



Joined: 11 Jan 2012
Posts: 3

View user's profile Send private message

PostPosted: Thu Jan 12, 2012 12:13 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Jan 12, 2012 9:50 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group