I have been experience some I2C problems between MEGA and UNO. First I wire a I2C device#1 to MEGA, and works fine. Then I wire the device#1 to UNO and the same program, and it doesn't work.
A few days later, I did another experiment. I wire I2C device#2?which works with UNO each time) to MEGA, and it doesn't work with the same program.
Then I did a final test with I2C device#3, I work with MEGA at both 400kbps and 100kbps rate, but device#3 can only works with UNO at 100kbps rate.
Show us the code and wiring you used for the 3 devices and provide links to the datasheets of the parts.
There is no relevant difference between the I2C on the UNO (ATmega328) and the Mega (I guess a ATmega2560). The I2C devices I have work with both of them using the same code but of course there are differences in details because the two boards are different. The capacity of the two solutions may be slightly different, so without external pull-ups you might get different results.
pylon:
Show us the code and wiring you used for the 3 devices and provide links to the datasheets of the parts.
There is no relevant difference between the I2C on the UNO (ATmega328) and the Mega (I guess a ATmega2560). The I2C devices I have work with both of them using the same code but of course there are differences in details because the two boards are different. The capacity of the two solutions may be slightly different, so without external pull-ups you might get different results.
code in library:
//uint8_t twbrbackup = TWBR;
//TWBR = 12; // upgrade to 400KHz!
// TWBR = twbrbackup;
if I enable the above sentences, It doesn't work at UNO.
void GOFi2cOLED::display(void) {
sendCommand(0x00 | 0x0); // low col = 0
sendCommand(0x10 | 0x0); // hi col = 0
sendCommand(0x40 | 0x0); // line #0
// save I2C bitrate
//uint8_t twbrbackup = TWBR;
//TWBR = 12; // upgrade to 400KHz!
// I2C #if defined(ARDUINO) && ARDUINO >= 100
for (uint16_t i=0; i<(12864/8); i++)
{
// send a bunch of data in one xmission
Wire.beginTransmission(SlaveAddress);
Wire.write(GOFi2cOLED_Data_Mode); // data mode
for (uint8_t x=0; x<16; x++)
{
Wire.write(buffer);
i++;
}
i--;
Wire.endTransmission();
} #else
for (uint16_t i=0; i<(12864/8); i++)
{
// send a bunch of data in one xmission
Wire.beginTransmission(SlaveAddress);
Wire.send(GOFi2cOLED_Data_Mode); // data mode
for (uint8_t x=0; x<16; x++)
{
Wire.send(buffer);
i++;
}
i--;
Wire.endTransmission();
} #endif
// TWBR = twbrbackup;
}
Try 2k2 pullups, 10k is to high. If the capacity of the circuitry is just minimally different your pullups may fail to get the necessary level in time at higher frequencies.