I'm working with Wire library,Arduino Mega and I2C bus (20 and 21 pin), i need to use 3.3 volts i2c devices but SDA and SCL on Mega ever have pull ups to 5v.
Is possible to dissable pull ups on pin 20/21 ? how ?.
Level shifter is the only solution?
I tried to modify twi.c without results.
Yes, its possible, so that external pullups to 3.3V can be used.
I don't recall how, browse the forum, it's been posted here sometime since this summer.
Check the Playground as well.
Wow ! after 2 days i found the problem, the Mega board have 2 hardware resistors pulled to +5v , therefore is impossible to disable it by software, you can see in the schematic here http://arduino.cc/en/uploads/Main/arduino-mega2560_R3-schematic.pdf in the upper right.
On the board the resistors is a four-pack right to the On led.
This has caused several problems, because I disabled the pull-up in Wire.h library(without effect), and pull up I2c with external resitors to +3v3, but with the unknowed resistors to +5v I added serial resistors from 5v to 3v3 line via SDA/SCL, therefore extra volts to the 3v3 line(4,5v mesured) , and generate unstability.
Caution with Mega board an 3v3 devices, is easy to have tosted…
I hope this help to others.
So are you going to remove them & replace the other 2?
yes, I desoldered de on-board resistors and works fine with the other pull ups to 3.3v.
Thank you. This helped me before I made a mistake.
I'm about to make an I2C bus between one RaspberryPI (3,3v) and two Arduinos, one of them is a Mega (the other a UNO).
So I should find a solution (other that unsolding the pull-up resistor) to make the bus to properly work.
There is a level shifter in the playground that works very well from the NXP APP note AN10441 I've used it with 2N7000 Mosfets from 3V3 to 5 it works bi-directionally.