i2c not working on Mega 2560 R3

I've been trying to get some VEX integrated motor encoders to talk, with little luck. I had four of them daisy-chained, but now I've pruned it down to just one, and I can't get that one to respond either.

I'm using SDA 20 and SCL 21, and have tried with and without pullup resistors.

I've also tried disabling the internal pullup activation in twi.c.

But here's the thing... I hooked it up to my oscilloscope, and SCL doesn't seem to be clocking. Just to make sure I wasn't doing something dumb, I wrote a tiny little i2c program and ran it on my Uno, and the i2c clock pin was doing what you'd expect, spitting out a square wave. On the Mega... nothing. Its just high, at 5V, on both of the boards I've tried. I put the 'scope in capture mode, and was able to get a couple drop-to-zero transients, but nothing I'd call a clock. Same story on the data pin, I don't really see it doing anything there either.

Really confused, not sure what I should try next.

Strange datapoint… If I don’t call Wire.begin(), I’m able to write to the device (its status LED turns green and blinks).

If I call Wire.begin(), it ignores the write (the status LED stays yellow).

In both cases, it hangs on a read later on.

Even though it appeared to work a little, there’s no regular clock signal on the 'scope. Is it clocking on noise? :slight_smile:

frabjous: I wrote a tiny little i2c program and ran it on my Uno, and the i2c clock pin was doing what you'd expect, spitting out a square wave. On the Mega... nothing.

May we see this program?