Pages: [1]   Go Down
Author Topic: Arduino Due TWI/I2C channel 1  (Read 505 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
// 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
  }
  delay(1);
}
 




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


* TWI_0.bmp (879.43 KB, 640x469 - viewed 13 times.)

* TWI_1.bmp (879.43 KB, 640x469 - viewed 9 times.)
Logged

Venezuela
Offline Offline
God Member
*****
Karma: 17
Posts: 522
Ground, ground, always ground
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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,

p
Logged

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 47
Posts: 2892
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Doc
Logged

--> 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

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: