Go Down

Topic: Arduino Due to Mega i2C not working (Read 1 time) previous topic - next topic


Sep 21, 2013, 11:47 pm Last Edit: Sep 22, 2013, 12:03 am by Timboh56 Reason: 1
Hi, I have an arduino due connected via i2c to a mega. I am using the SDA and SCL channels on the mega which are connected to the SDA and SCL channels on the Due respectively. The two channels are powered by the 3.3 V from the Due, which runs through 1.5k Ohm pullup resistors. When transmitting data from the Due to the mega, I am not receiving any data from the Mega. I am using arduino 1.5.4. Here is the code for the Due:

#include <Wire.h>
#include <Timer.h>

Timer t;

void setup()
 Serial.begin (9600);
void loop()

void transmitData()
 Serial.println("Transmitting data...");
 Serial.println("Data transmitted.");

And the mega

under setup..
 // receive incoming data from uno board for shaft encoder


void receiveEvent(int byteCount)
 Serial.println("Receive event");
   char c = Wire.read();
   Serial.println("received from secondary board");

The code previously worked fine with connecting to an arduino Uno but when I use the Due I get a very different result. Are there any quirks about the Due I should be aware of, such as the fact it takes 3.3V?


you probably need a voltage translator (page 10 http://www.nxp.com/documents/application_note/an97055.pdf) between the two boards.
Both the UNO and the MEGA run at 5V and so their SCL and SDA channels will take for logic level something like <0.3*Vdd is LOW and >0.7Vdd is HIGH. If you make the calculation 0.7Vdd with Vdd= 5V is 3.5V which is ok for a UNO to MEGA connection with the pull ups at 5V but it is higher than the 3.3V at which you are pulling up your lines when having the DUE to MEGA connection.
I would also suggest you to change the pullups. Rip out the one on the arduino Due (which on the schematic is said to be 1.5K but in reality is just 1K) and add an external 4.7K on both sides of the translator.

Go Up