AnsweredAssumed Answered

Help with AD5293

Question asked by Stev067 on Jul 8, 2011
Latest reply on Jul 19, 2011 by Stev067

Hello, I am attempting to use an AD5293 digital potentiometer using an ATmega328 microcontroller using Arduino (C++). I have it surface-mounted to my PCB in the feedback loop of an LM2676 switching mode power supply. I am only attempting to write data to it, and I do not care to read any back. However, it seems I am unable to change the wiper position and I don't quite know what the problem is, but I suspect it to be my code. I'm not sure if anyone here is familiar with the arduino language but it is pretty straightforward, and has an SPI library to make things simple. Does anything jump out as being wrong or missing?

 

#include <SPI.h>                           //Serial Protocol Interface for AD5293

 

/**AD5293 Digital Potentiometer**/

const int slaveSelectPin = 10;

const int MOSI           = 11;

const int SCK            = 13;

/********************************/

 

 

setup() {

  pinMode(slaveSelectPin, OUTPUT);

  digitalWrite(slaveSelectPin, HIGH);

  SPI.begin();

  SPI.setBitOrder(MSBFIRST);                   //MSB First

  SPI.setDataMode(SPI_MODE1);              //CPOL=0, CPHA=1

  SPI.setClockDivider(SPI_CLOCK_DIV4);

}

 

 

 

//In this section, I am trying to disable the write-protection, and then write a value of 3FF (1023) to the wiper register:

  digitalWrite(slaveSelectPin, LOW);
  SPI.transfer(0x1802);
  digitalWrite(slaveSelectPin, HIGH);
  delay(1);
  digitalWrite(slaveSelectPin, LOW);
  SPI.transfer(0x07FF);
  digitalWrite(slaveSelectPin, HIGH);
  delay(1);

 

 

I have used a different digipot in this project before, but I am a bit unfamiliar with SPI, so I don't know what the problem is. Also, is there a similar part that I could use to test on a breadboard?

 

Thanks very much.

Steve Walsh

Outcomes