I2C pull-ups resistors.

Hey :)

When using the arduino's i2c ports (4/5) is it need to use external pull-up resistors?

As far as I know if the wire library is being used the internal pull-ups are automatically enabled.

Thanks

KenshinPT: Hey :)

When using the arduino's i2c ports (4/5) is it need to use external pull-up resistors?

Yes.

KenshinPT: As far as I know if the wire library is being used the internal pull-ups are automatically enabled.

No. I2C requires that pullups are external (so that you know there is only one pullup when there are many devices).

I'm using the I2C bus without any external pull-up resistors and 3 devices attached, and not having any problems. The mcu's internal ones seem to be doing fine.

The strength of pull-ups for I2C depends on the loading - more devices on the bus, the stronger the pull ups need to be to get fast enough rising edges.

A good compromise figure is 4k7, which ought to be OK with one or several devices and a reasonable length of bus cabling too.

The internal pull-ups are 20k to 50k (thats all the datasheet promises), so is weak (one I2C device with low-capacitance inputs close to the microcontroller should work, but its a bit fragile).

People tend to use 10k or 4k7, and even 2k2 if the device is at the end of significant length of cable (because of the capacitance of the cabling).

If you are interfacing to 3V3 devices you want external pull-ups to 3V3, and the internal pullups then are useful in boosting the voltage a little above 3.3V to help at the 5V side.

MysteriousAges: I'm using the I2C bus without any external pull-up resistors and 3 devices attached, and not having any problems. The mcu's internal ones seem to be doing fine.

Yes but they are not doing fine at all. read this:- http://www.dsscircuits.com/articles/effects-of-varying-i2c-pull-up-resistors.html

fungus:

KenshinPT: Hey :)

When using the arduino's i2c ports (4/5) is it need to use external pull-up resistors?

Yes.

KenshinPT: As far as I know if the wire library is being used the internal pull-ups are automatically enabled.

No. I2C requires that pullups are external (so that you know there is only one pullup when there are many devices).

No Electrically the open drain with internal pull-ups enabled on a 328p chip (as performed by the wiring library) does satisfy the I2C requirement that the clock and data signals need to be pulled-up to allow for bidirectional communications. The fact that the enabled pull-ups are of a larger then normal ohms value does certainly limit it's ability to service longer distances and better wave shaping. The 'optimum' value of the pull-up resistors is always implementation specific, not a I2C standard specification. In this case an O-scope is a better instrument to utilize then the standards documentation.

MysteriousAges: I'm using the I2C bus without any external pull-up resistors and 3 devices attached, and not having any problems. The mcu's internal ones seem to be doing fine.

Key word: "seem".

In reality you're living dangerously by doing that.

fungus:

MysteriousAges: I'm using the I2C bus without any external pull-up resistors and 3 devices attached, and not having any problems. The mcu's internal ones seem to be doing fine.

Key word: "seem".

In reality you're living dangerously by doing that.

LOL. Solders serving in combat live dangerously, some law enforcement live dangerously, Arduino users getting their I2C devices working, not so much. ;)

retrolefty: Electrically the open drain with internal pull-ups enabled on a 328p chip (as performed by the wiring library) does satisfy the I2C requirement that the clock and data signals need to be pulled-up to allow for bidirectional communications.

OK, I thought that the internal pullups were always disabled when I2C was enabled on a Mega328.

The datasheet says (in section 21.5.1):

SCL and SDA Pins: These pins interface the AVR TWI with the rest of the MCU system. The output drivers contain a slew-rate limiter in order to conform to the TWI specification. The input stages contain a spike suppression unit removing spikes shorter than 50 ns. Note that the internal pull-ups in the AVR pads can be enabled by setting the PORT bits corresponding to the SCL and SDA pins, as explained in the I/O Port section. The internal pull-ups can in some systems eliminate the need for external ones.

But yes, the internals pullups are very weak. I don't think it's a good idea to use them unless your I2C device is right next to the AVR chip.

retrolefty: LOL. Solders serving in combat live dangerously, some law enforcement live dangerously, Arduino users getting their I2C devices working, not so much. ;)

He might be selling to the mafia.... :astonished:

fungus:

retrolefty: Electrically the open drain with internal pull-ups enabled on a 328p chip (as performed by the wiring library) does satisfy the I2C requirement that the clock and data signals need to be pulled-up to allow for bidirectional communications.

OK, I thought that the internal pullups were always disabled when I2C was enabled on a Mega328.

The datasheet says (in section 21.5.1):

SCL and SDA Pins: These pins interface the AVR TWI with the rest of the MCU system. The output drivers contain a slew-rate limiter in order to conform to the TWI specification. The input stages contain a spike suppression unit removing spikes shorter than 50 ns. Note that the internal pull-ups in the AVR pads can be enabled by setting the PORT bits corresponding to the SCL and SDA pins, as explained in the I/O Port section. The internal pull-ups can in some systems eliminate the need for external ones.

But yes, the internals pullups are very weak. I don't think it's a good idea to use them unless your I2C device is right next to the AVR chip.

I agree with that. But do keep in mind that the I2C bus standard was designed for ICs to communicate on the same or very closely coupled PCB(s), think daughter/mother or arduino/shield arrangement. I've never had the need to add external pull-ups for the RTC and ADC modules I've tested out. But if designing a PCB I would add physical external resistors to it.

Grumpy_Mike: Yes but they are not doing fine at all. read this:- http://www.dsscircuits.com/articles/effects-of-varying-i2c-pull-up-resistors.html

Did some poking; this is the current link: http://www.dsscircuits.com/index.php/articles/47-effects-of-varying-i2c-pull-up-resistors

I suppose I'll add some resistors after all. :x

MysteriousAges: Did some poking; this is the current link: http://www.dsscircuits.com/index.php/articles/47-effects-of-varying-i2c-pull-up-resistors

I suppose I'll add some resistors after all. :x

Great explanation. Thank you so much.

MysteriousAges:

Grumpy_Mike: Yes but they are not doing fine at all. read this:- http://www.dsscircuits.com/articles/effects-of-varying-i2c-pull-up-resistors.html

Did some poking; this is the current link: http://www.dsscircuits.com/index.php/articles/47-effects-of-varying-i2c-pull-up-resistors

I suppose I'll add some resistors after all. :x

You mean earlier in the thread?