Analog AD5235 Digital Pot with SPI not working

I'm trying to get an Analog AD5235 digipot working. All I want to do is write a value to each of the 2 channels as a test...simple! But for some reason I can't get it to do anything. I've triple checked the wiring according to the data sheet. I'm using a Mega 2560.

I have A and B of each channel on the pot connected to +5V and GND and am measuring the voltage from the wiper. The basic code I have is essentially this:

#include <SPI.h>

void setup(){
SPI.begin();
digitalWrite(slaveSelectPin, LOW);
SPI.transfer(0xB00100);
digitalWrite(slaveSelectPin, HIGH);
digitalWrite(slaveSelectPin, LOW);
SPI.transfer(0xB10200);
digitalWrite(slaveSelectPin, HIGH);
}

void loop()
{
}

The commands are from the AD5235 data sheet. I've also tried the more "basic" commands which also do not work:

digitalWrite(slaveSelectPin, LOW);
SPI.transfer(0);
SPI.transfer(50);
digitalWrite(slaveSelectPin, HIGH);

etc... one wiper is measuring 0v and the other 5v. Any ideas?

Do you use the right pins for SPI according to the 2560 ?

The hardware of 2560 is described as :

SPI: 50 (MISO), 51 (MOSI), 52 (SCK), 53 (SS). These pins support SPI communication using the SPI library. The SPI pins are also broken out on the ICSP header, which is physically compatible with the Uno, Duemilanove and Diecimila.

Grag38:
Do you use the right pins for SPI according to the 2560 ?

The hardware of 2560 is described as :

SPI: 50 (MISO), 51 (MOSI), 52 (SCK), 53 (SS). These pins support SPI communication using the SPI library. The SPI pins are also broken out on the ICSP header, which is physically compatible with the Uno, Duemilanove and Diecimila.

Yes, I am using those pins and have also modified pins_arduino.h to set the correct variables to do so.

I actually appear to be getting activity, but when using an analog pot to vary the value sent to the digi pots the voltage appears to be going all over the place...fairly random, not a smooth up down. It will go from 0-5v and then reset, then do random stuff.

I know this is an old thread but for anybody trying to interface a 1024 Position (10-bit) Digital Potentiometer (AD5231 - AD5235), I wrote a tutorial here:

http://www.reigndesign.com/blog/controlling-a-10-bit-digital-potentiometer-via-spi-with-arduino/

The key here is to get the bits transfered in the right way, SPI.transfer takes a byte as an argument so it only transfer 8-bits at a time.

I hope it helps.