Go Down

Topic: Newbie: UnoR3 I2C with digipot MCP4442 not working (Read 609 times) previous topic - next topic

durchgedreht

Hi,
I'm struggling to get I2C running on my digipot. Maybe someone can help:

I am using an Arduino Uno R3 and have connected Pin 4 and 5 for the I2C data transfer. I am using 5V from the Arduino output. I have used the MCP4442 digipot, specs can be seen here (extensive, but I seem to miss the 2 important lines!):
http://www.reichelt.de/index.html?;ACTION=7;LA=3;OPEN=0;INDEX=0;FILENAME=A200%252FMCP444X-446X.pdf;SID=10TxANVH8AAAIAAB8AAvM710275ceb54e47f0c3df9252c87273ab

When I power on the arduino, the rheostat goes to 50kOhm which is the initial mid wiper position (so seems to work as defined). Anyway I also tried connecting 2  Pullups resistors of 10kOhms, but no change.

I tried to look close on this tutorial. Especially as it uses also a MCP chip and the chip has even thesame ID (at least to address one pot).
http://tronixstuff.wordpress.com/2010/10/20/tutorial-arduino-and-the-i2c-bus/

Here is my Sketch:

Code: [Select]

// written to debug MCP4442

byte wiperSetting = 0x00; // min value
//byte wiperSetting = 0x40; // max value 7Bit
//byte wiperSetting = 0x80; // max value 8Bit - do not use

#include "Wire.h"

void setup()
{
  Wire.begin();
  Serial.begin(9600);
}

void loop()
{
  //Set all 4 Digipots to same value!
 
  Wire.beginTransmission(0x2C);
  Wire.write(wiperSetting);
  Wire.endTransmission();
 
  Wire.beginTransmission(0x2D);
  Wire.write(wiperSetting);
  Wire.endTransmission();
 
  Wire.beginTransmission(0x2E);
  Wire.write(wiperSetting);
  Wire.endTransmission();
 
  Wire.beginTransmission(0x2F);
  Wire.write(wiperSetting);
  Wire.endTransmission();
 
  delay(2000);
}


pylon

You probably misunderstood something.
Code: [Select]
  Wire.beginTransmission(0x2C);
  Wire.write(wiperSetting);
  Wire.endTransmission();


This addresses the chip if the address pins 0 and 1 are connected to ground. Then you send the wiper setting without addressing the register. This does not work. To set the first wiper:

Code: [Select]
  Wire.beginTransmission(0x2C);
  Wire.write(0x00); // write to address 0 (wiper 0)
  Wire.write(0x00); // lower 8 bits of data value
  Wire.endTransmission();


For wiper 1 it is:

Code: [Select]
  Wire.beginTransmission(0x2C); // same address!
  Wire.write(0x10); // write to address 1 (wiper 1)
  Wire.write(0x00); // lower 8 bits of data value
  Wire.endTransmission();


The format is described on page 61 of the datasheet.

durchgedreht

Hi,

thanks very much for the valueable input!

I tried that yesterday night, but unfortunately didn't have success. I'm wondering if my breadboard connections might have an issue. Power is fine, otherwise the wipers wouldn't move to default settings and TSSOP board soldering was also crosschecked. Will check breadboard again today evening and post a pic with connections. It shouldn't be that hard to get this small thingy running :-)

Any other suggestions what I could have done still welcome. Turnaround with Arduino is so great when comparing this to my old days in PICs (many years ago). Works like a charm - I'm completely impressed.

Go Up