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 internal pull-ups

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



Joined: 25 Jun 2008
Posts: 1

View user's profile Send private message

I2C and internal pull-ups
PostPosted: Wed Jun 25, 2008 2:41 am     Reply with quote

Hello,

I want to use the internal pull-ups of an 16F886 with the I2C functions.
I'm using pin RB1 for SDA and pin RB4 for SCL. So I'm not using the hardware pins for the I2C. It is possible to switch the pull-ups individually. So far there is no problem. But at the point I'm using the i2c_start() function, the pull-up is switched off. I think it should be possible to let the pull-up high in case of using the pin as an input with a software i2c. But this will not work.

Is it not possible to use the I2C with the internal pull-up ?

Maybe someone can help me

Hermann
Ttelmah
Guest







PostPosted: Wed Jun 25, 2008 3:16 am     Reply with quote

I'm afraid you have to add external pull-ups.
The internal pull-ups just aren't strong enough to drive an I2C bus.
They are typically equivalent to between about a 100KR to 15KR resistor.
I2C, at 100K, even with a low bus capacitance of perhaps 70pF, requires a minimum of about 17KR for it's pull-ups, and with a more typical 100pF, the minimum is about 9KR. You might _just_ get it to work at a very low I2C rate, if your device has particularly 'strong' pull-ups, but it is never going to be reliable.

Best Wishes
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Wed Jun 25, 2008 8:11 am     Reply with quote

Internal pull-ups are only used when the pin is in input mode. As soon as the TRIS is changed to make the pin an output the pull-up is disabled. With this being said, when the pin tries to drive the bus the pull-up will not be available. External resistors are required.

Ronald
Ttelmah
Guest







PostPosted: Wed Jun 25, 2008 9:53 am     Reply with quote

I think the 'idea' ought to work, but is so far outside the specs, that it is unlikely to be even remotely practical!.
The pull up is disabled when TRIS is set to 0, making the pin an output, but if the chip's logic diagram is right, should come on again when it is set back to '1'. In software I2C, the technique used, is to put a '0' into the output latch, and then set TRIS to '1', when you want a '1' out (driver turns off, and the line is pulled up by the resistor on it), and then set the TRIS to '0', when you want to pull the line down. As such, if the internal pull up is enabled, it should pull the line high, when needed. However the available pull-up current, is off the end of the graph for the I2C bus spec. Two limits apply, the one on bus capacitance (which limits the speed the link could be run), and the spec in I2C, that the inputs can require up to 10uA pull-up current. The graphs f 'maximum pull-up resistor', basically end just under 20K, and the PIC internal pull-up, is unlikely to be lower than this.
'Nice idea', but it isn't going to work...

Best Wishes
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