Go Down

Topic: Arduino Due TWI/I2C channel 1 (Read 1 time) previous topic - next topic


I'm having difficulties getting the second I2C channel working correctly.

Running the example code "I2C Digital Potentiometer" i got the expected result. (TWI_0.bmp logic analyzer screen cap)

i then modified it  for channel 1 by changing "wire" to "wire1" with no success. (TWI_1.bmp logic analyzer screen cap)

Code: [Select]
// I2C Digital Potentiometer
// by Nicholas Zambetti <http://www.zambetti.com>
// and Shawn Bonkowski <http://people.interaction-ivrea.it/s.bonkowski/>

// Demonstrates use of the Wire library
// Controls AD5171 digital potentiometer via I2C/TWI

// Created 31 March 2006

// This example code is in the public domain.

// This example code is in the public domain.

#include <Wire.h>

void setup()
  Wire1.begin(); // join i2c bus (address optional for master)

byte val = 0;

void loop()
  Wire1.beginTransmission(44); // transmit to device #44 (0x2c)
                              // device address is specified in datasheet
  Wire1.write(byte(0x00));            // sends instruction byte 
  Wire1.write(val);             // sends potentiometer value byte 
  Wire1.endTransmission();     // stop transmitting

  val++;        // increment value
  if(val == 64) // if reached 64th position (max)
    val = 0;    // start over from lowest value

SDA1 and SCL1 both have added 1K5 pull-up resistors.
Has anyone had a similar problem or have a suggestion to resolve this?


Hello silen1985,
The whole Due's TWI code is OK and perfectly handles both I2C peripherals (TWI/TWI1). IMHO, your issue should be related to hardware. I'd recommend to use a different pull up value like 10K. Regards,



The outputs of the Due is about 4 mA, the Arduino about 20 mA... for best performance the IIC Pull ups should be 2k2 ohms for a 1.5 mA bus current. 10k will allow 330uA which makes length and thus loading capacitance more of an issue than the 2k2 value would.

--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard


thanks for the seggestions

after checking the pull-up ressistors again i found that they were connected to GND not 3V3 when they were resoldered the board worked as expected.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131