Good day,
I am hoping that someone can steer me towards a solution to a strange problem I am having with Arduino UNO and AD5252 digital potentiometer on I2c.
I built an initial test circuit a while back that was using the AD5252 device and I could communicate with it without any trouble. I then designed the final circuit and connected the devices. Suddenly no matter what I do the UNO won't communicate with the device on I2C.
I designed a new PCB that only takes the AD5252 device, thinking there is a design fault on the final PCB. So it only has the AD5252 on with wires to all the points. /WP is pulled to 5V, to take it out of write protect. AD1 and AD0 is pulled to zero to set the device address to 00. I2C device address 01011 so total address 0101100, decimal 44.
So here is the problem. If I connect a digital storage scope to the A4 data pin on Arduino and i write the following:
Wire.beginTransmission(B0101100); //(44)
Wire.write(B00000001); //Instruction (CMD(1) or /REG(0), 0, EE(1) or /RDAC(0), Address RDAC 1(00001)
Wire.write(B00011001); //value to set RDAC to 25
byte error = Wire.endTransmission(); //send bytes?
Serial.println(error);
On the scope, I can see that this line is sent. Wire.beginTransmission(B0101100); but nothing else is sent. The address is sent and then the NAK is received from the slave (error=2), but the next two lines of Wire.write is not sent.
Why?
I know the I2C on the Arduino UNO is working as I connected a real time clock circuit to it. It works.
I tried another UNO anyway same problem.
I bought new AD5252 ICs same problem.
Tried different values of I2C pull-up resistors. (currently 3K9)
I have scoured the net and several forums for a similar issue.
Just looking at the scope output again.
The acknowledge bit is a 1. This should be 0? Could mean that the AD5252 is still locked somehow or the address is wrong?
I suppose that was the meaning of error code 2. NAK (not)
The functions to beginTransmission() and write() will only set the data into a buffer.
The function endTransmission does the actual I2C session.
When the endTransmission() function is stuck and does not return, the I2C hardware is wrong. Like a shortcut between SDA and SCL, or one of those shortcut to ground.
Power your board. Measure the voltages of SCL and SDA, are they near 5V ? Measure the shortcut current of SDA and SCL to ground, do they match with the pullup resistor ? When you make one low, does the other stay high.
If all that is okay, run the i2c_scanner: http://playground.arduino.cc/Main/I2cScanner
The DA5252 is very fine pitch so I did confirm under a microscope and measuring(DMM) that there are no shorts. Checked now as well by shorting each line to ground and then checking if the other line stays at 5V. All OK.
I can also see the first byte (address) and the clock on scope. It seems to me that the IC is not accepting the address. In other forum posts there was an I2C command to disable write protect. But this device has a /WP pin. Active Low.
From Documentation: Setting the WP pin to logic low after EEMEM programming protects the memory and RDAC registers from future write operations. In this mode, the EEMEM and RDAC read operations function as normal. WP can be permanently tied to VDD without a pull-up resistor if the write-protect feature is not used. If WP is left floating, an internal current source pulls it low to enable write protection
I have tried /WP directly to VDD and currently through pull up resistor to VDD.
OK. I think i have figured out the problem. ID10t problem
I think i might have hurt the first IC by plugging in the SCL line before plugging in VDD and VSS. you mess with the ESD protection diodes when you mess up the power up sequence.
After that I started hacking and slashing and at some stage i decided I don't need the digital ground. Not entirely sure why i decided that. it seems you don't need VSS. BUT you have to have the digital ground.
So at the moment i have I2C connection. I will build up the circuit again with the original ic and see if it is as dead as i fear.
Okay, perhaps it is broken.
The SCL line is only powered by the pullup resistor, it should not damage things.
I don't have troubles with ESD, I live near the sea, and the air humidity is always high.