wire without enabling pull up resistors?

It would be nice to have a flag to disable the internal pull up resistors in i2c and implement external pull ups to 3.3V

I have been forced to modify twi.c myself to accomplish what you want.

It might be hard to have a software flag enable pull-ups to another voltage though, you should either implement the resistors externally, or run the AVR at 3.3V at 8 MHz

Agree. I guess I am proposing a flag to just disable the automatic pull ups.

@Frank: why were you 'forced' to change the library? Once you've called 'tw_init', you can do what you like with the pull-ups. No need to modify the library.

I agree with the original post. If one has a I2C device that is powered by 3.3V and is not 5V tolerant, using the current Wire library will cause 5V to be applied through the internal pullup resistors of the Atmel part to the I2C device. If you correct this by just disabling the pullups after calling tw_init() the I2C device has already had 5V applied to it, which is out of its specifications. It would be better to pass in a parameter to Wire::Begin() which never enables the internal pullups. Then by using external pullups to 3.3V both the I2C device and the Atmel part will be happy.


I'm using a DS1307 I2C RTC and external 2k2 pull-up resistors like shown in this page:


Are these external resistors required? Is Arduino using internal pull-up resistors?


Well keep in mind that the internal pull-up resistors are of a pretty high value, 40K or over as I recall, so even if wired to non-tolerant 3.3vdc input devices, I wouldn't expect any damage due to that high current limiting resistance, it may even work.


Lefty: When a semiconductor manufacturer publishes absolute maximum specs, they are indicating that they do not test nor guarantee the behavior of their products when used outside of the specs. While I agree that many devices will probably not be permantely harmed by the small current the weak pullups will deliver, that is not to say that some may not suffer permanent damage.

It is better to adhere to the specs. in my opinion.

A simple change to the Wire class could add an additional Wire.enable_pullups() function which could be called in setup() after Wire.begin().

This would allow the end user to easily select the behavior they desire.

BTW, the minimum value for the pullup resistors on the ATMEGA328P part is shown as 20K. This could cause a whopping 85 microamps of current to flow into a 3.3 volt part's pin. While this is not exactly likely to cause a part to meltdown, it is also better to remain within the part's specs.

Jose: The external resistors shown are probably not necessary.

The default Wire library enables the internal pullup resistors of the Arduino.

In fact, an update on the website you referred to notes this.

The only potential issue is that the internal pullup resistors are larger than that you are currently using, so it is possible that if your cable length going to the RTC is too long that the capacitance of the cable will cause the signals to be corrupted.

You probably do not have long signal wires going to RTC.

Just remove the external resistors and give it a try.

It would be nice to have a flag to disable the internal pull up resistors in i2c and implement external pull ups to 3.3V

Just use external 4k7 pull-ups to 3V3, the internal pullups won't be able to compete and it'll just work without modification.