3
\$\begingroup\$

I have a doubt in I2C pull up resistor. Actually I am developing a I2C module using GPIO pins. I have used external pull up resistor(10k) for the SDA and SCL lines. Do I need to enable the internal pull up also along with External pull up or external pull up is enough. How does the combined external and internal pull up effect the communication.? Please reply

Thanks

\$\endgroup\$
3
  • 3
    \$\begingroup\$ What chips / microcontrollers are you using? \$\endgroup\$
    – CurtisHx
    Commented Jul 1, 2015 at 16:27
  • 1
    \$\begingroup\$ What do you want your I2C device to act as. Master or Slave? \$\endgroup\$
    – User323693
    Commented Jul 2, 2015 at 2:25
  • 1
    \$\begingroup\$ i2c device is acting as slave. \$\endgroup\$ Commented Jul 2, 2015 at 10:48

2 Answers 2

2
\$\begingroup\$

It depends on the specific architecture you are using. If the microcontroller you are targeting has internal pull-ups, then you need to make sure that they are strong enough should you enable them to be able to omit the external pull-ups.

If it isn't strong enough, then you don't need to enable it and you'll be fine with just using external pull-ups.

If by some freaky architecture, the pull-up is always enabled, you can effectively treat the internal pull-up as a resistor in parallel with the external pull-up since they'll both be pulling up to VCC. Realize that when they are in parallel, the resulting resistance may be too low, so make sure that the end result is still capable of being a proper pull-up.

\$\endgroup\$
7
  • 1
    \$\begingroup\$ I can disable the internal pull up. But why I asked this because, earlier when I was working with internal pull up disabled, the data in the data line was observed different when i worked with both pull ups enabled. Even if I use internal pull I was able to do I2C communication. \$\endgroup\$ Commented Jul 1, 2015 at 16:34
  • 1
    \$\begingroup\$ What is the value on the internal pull-up? Remember that if you put both pull-ups on, the total resistance will be lower, possibly falling below the required strength. \$\endgroup\$
    – Funkyguy
    Commented Jul 1, 2015 at 16:35
  • 1
    \$\begingroup\$ I went through the datasheet .. But couldnt find the internal pull up value. \$\endgroup\$ Commented Jul 1, 2015 at 16:38
  • 1
    \$\begingroup\$ What controller are you targeting? This is the kind of information that you would put in the original question. \$\endgroup\$
    – Funkyguy
    Commented Jul 1, 2015 at 16:38
  • 1
    \$\begingroup\$ @AksharaPrasad That doesn't help in the slightest. Specifically which one? Then I can look through it myself. Nobody is going to steal your idea. \$\endgroup\$
    – Funkyguy
    Commented Jul 1, 2015 at 16:40
1
\$\begingroup\$

If I understand it correctly you want to bit-bang that I2C bus. There're a few things you have to keep in mind.
1. AVRs and PICs have quite high resistance internal pullups so you need an external resistors anyway (2k to 4.7k).
2. Make sure that your GPIOs are open drain since I2C bus is an open drain bus. AVRs or PICs won't let you do that though. The way to do that is to use the direction register when driving the bus instead of the output register and set the output value to 0. So if you want to drive the bus low set the GPIO direction to output and when you want drive the bus high set to input.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ Open drain enable means slave device transistor should drive the signal to LOW... right?? I am exactly doing the way you mentioned whenever I try to drive the bus high or Low. Yes I am bit banging the I2C. \$\endgroup\$ Commented Jul 1, 2015 at 16:45
  • 1
    \$\begingroup\$ Right. You drive low's (0s) only. When you need to drive a 1 you just let the pullups do the trick. Therefore the lower the pullups value the higher the bus speed since the rising edges are driven by the pullups. So at the usual 100kbps, pullups should not be more than 10k. I would use even lower values if it's not some crazy low power design. \$\endgroup\$
    – Alexxx
    Commented Jul 2, 2015 at 17:45
  • \$\begingroup\$ Hello Alexxx, I was reading ur comment dated: 1 July 2015. Could you please tell, why direction should be set as input to drive the bus HIGH. What will happen if BUS is set HIGH by setting the direction to output and writing output value to 1? \$\endgroup\$ Commented Feb 18, 2017 at 19:55
  • \$\begingroup\$ Hi Akshara Prasad. The HIGH line is defined by the Pull-Up resistor, so any device on the line can drive the line low if needed (by configuring the pin as input, you let to take over the line by the Pull-Up resistor). If you set the pin on the line to output, this pin will take the line over, so setting the output to HIGH means no other device will be able to drive the line low. \$\endgroup\$
    – d3rbastl3r
    Commented Nov 18, 2022 at 12:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.