Controlling the AD5254 Digital Potentiometer

I'm having a heck of a time trying to control the first potentiometer RDAC0 in the AD5254 chip.
I've read the only two other forum posts that I've found on this particular chip and I'm trying to modify the digital_potentiometer example that controls the AD5171 digital potentiometer which is very similar with some exceptions.

The question is the following:
How do I query for the acknowledgement from the slave chip is supposed to come after sending the slave address down the bus, after the instruction set to the slave and after the data byte?

I'm assuming that the wire.h library takes care of the Start sequence and notifying the slave (by sending the slave address down the bus) that it has some instructions coming its way with the Wire.beginTransmission()

does this library also take care of the Acknowledge bit that the slave sends out? or do I have to end the transmission and then query the bus?

Any insight into this will be very helpful.

Thanks in advance.

P.S. if anyone has a working sketch for this chip that would be great if it can be shared. I've already tried the one from neurostar that can be found on these forums but it does not quite work. If someone else has gotten this code to work with out any changes then please let me know so I can troubleshoot my set-up.

This should answer most of your questions:

It's not very complicated, the library does most of it.

Thank you for that link. I think it does answer my questions and I think the problem my be my device. I connected an oscilloscope to the clock and data line and I can clearly see the start the slave address and the write bit being sent but I think the device is not acknowledging the command as the just after the "write" bit the data line is pulled high then followed by a couple of other bits that I think are the stop command.

So my data ins not being transmitted because the slave is not acknowledging.

I'll change the device and see if I get a different response.

Thank you again,

That would certainly be a problem. I would be running the “i2c bus scanner” on that page I linked. Perhaps the device has a different address to what you expect.

Changed to a second device and same persists. I think It's time to review all the wiring and go back to the spec sheet for the device to make sure I'm not missing something very obvious.

EDIT: I'm making progress, as it turns out I had misinterpreted a setting from the device's spec sheet. The write protect pin was set to 5VDC and as soon as I changed it to ground the other two bytes showed up on the oscilloscope. The Device is now acknowledging the commands and I can see the rest of the pulse train that is supposed to be going to going down the bus. Now I'm just not seeing the change in the multimeter that I have connected to the set-up to verify the resistance is changing.

Please, share your code with us.

I made it work some time ago. I had not checked this post in some time. Here is an example that works.
I used some code I found online and I made a breakout board for the chip on eagle. I have acknowledgements and a documentation in progress in a post at www.familia-herrera.com (this is not meant to be a plug for my site as I don’t have anything to sell there I just don’t want to copy and paste the info, it would be too much for this forum.

#include <Wire.h>

int RDAC0 = 0;
int RDAC1 = 1;
int RDAC2 = 2;
int RDAC3 = 3;

int EEMEM0= RDAC0 +32;
int EEMEM1= RDAC1 +32;
int EEMEM2= RDAC2 +32;
int EEMEM3= RDAC3 +32;

//Set up routine
void setup()
{
Serial.begin(9600);  // start serial for output
Wire.begin(); // join i2c bus (address optional for master)


//Reads all RDAC Current Values and prints them on serial
readAllRDAC();
//byte rdac = readRDAC(0);
//Serial.print("RDAC0 Initial Value =");
//Serial.println(rdac,DEC);

//Reads all EEMEM Current Values and prints them on serial
readAllEEMEM();
//byte eem = readEEMEM(1);
//Serial.println(eem,DEC);
}

//*********************Start Main Loop**********************
void loop()
{
Serial.println("Enter a number to set RDAC0 to");
while (Serial.available() == 0);
{
 int valentered = Serial.parseInt();
 RDACWrite(RDAC0, valentered);
 delay(5);
 EEMEMWrite(EEMEM0, valentered);
 delay(5);
 
 int RDACvalread = readRDAC (0);
 delay(5);

 int EEMEMvalread = readEEMEM(EEMEM0);
 Serial.print("RDAC0 Value =");
 Serial.println(RDACvalread,DEC);
 Serial.print("EEMEM0 Saved Value =");
 Serial.println(EEMEMvalread,DEC);
}
}
//*************************End MAin Loop ***************************

// ************Start Function to Read All RDAC Current Values**********
int readAllRDAC()
{
Wire.beginTransmission(0x2c); // transmit to device U1 (0x2c or hex for 0101100)
Wire.write(0x00);
Wire.endTransmission();
Wire.requestFrom(0x2c, 4);  //Request four bytes from 
int rdacnum = 0;
while(Wire.available())    // slave may write less than requested
{
byte rdac = Wire.read(); // read a byte as character
Serial.print("RDAC");
Serial.print(rdacnum,DEC);
Serial.print(" = ");
Serial.print(rdac,DEC);         // print the character
Serial.print(" ");
rdacnum++;
}
Serial.println(" ");
}
//*****************End Function*************************************


//***************Start Function to read Individual RDAC Current Value *******************
byte readRDAC(int address)
{
Wire.beginTransmission(0x2c); // transmit to device U1 (0x2c or hex for 0101100)
Wire.write(address);           //RDAC Address 0 - 3
Wire.endTransmission();
Wire.requestFrom(0x2c, 1);
byte rdac;
if(Wire.available()) {   // slave may write less than requested
rdac = Wire.read(); // read a byte as character
}
return (rdac);
}
//*********************END function*****************************************************

//********************Start Function to Reads Current Value set for all EEMEM************
void readAllEEMEM()
{
Wire.beginTransmission(0x2c); // transmit to device U1 (0x2c or hex for 0101100)
Wire.write(0x20);
Wire.endTransmission();
Wire.requestFrom(0x2c, 4);
int eemnum = 0;
while(Wire.available())    // slave may write less than requested
{
byte eem = Wire.read(); // read a byte as character
Serial.print("EEMEM");
Serial.print(eemnum,DEC);
Serial.print(" = ");
Serial.print(eem,DEC);         // print the character
Serial.print(" ");
eemnum++;
}
Serial.println(" ");
}
//**************************END Function************************************************

//************START Function to READ Indvidual EEMEM Values*****************************
byte readEEMEM(int address)
{
//address = address + 32;
Wire.beginTransmission(0x2c); // transmit to device U1 (0x2c or hex for 0101100)
Wire.write(address);         //RDAC Address 0 - 3
Wire.endTransmission();
Wire.requestFrom(0x2c, 1);
byte eem;
while(Wire.available())    // slave may write less than requested
{
eem = Wire.read(); // read a byte as character
}
return (eem);
}
//**********************END Function ****************************************************

//************************START Function to Write to individual RDAC*********************
void RDACWrite(int address, int value) {
Wire.beginTransmission(0x2c);
Wire.write(address);            // writes instruction byte to RDAC1 (0x01 or hex for 0000001)
Wire.write(value);
Wire.endTransmission();
}
//*******************************ENF Function*********************************************

//************************START Function to Write to individual EEMEM*********************
void EEMEMWrite(int address, int value) {
Wire.beginTransmission(0x2c);
Wire.write(address);            // writes Current Wipper Setting for RDAC to EEMEM (0x20 or hex for 0010000 DEC 32 for EEMEM0)
Wire.write(value);
//Wire.write(address + 32);
Wire.endTransmission();
}
//*******************************ENF Function*********************************************