How to connect 3-wire spi with an arduino to the Maxim DS1801 digital resistor

3-wirearduinoserialspi

I just picked up an Arduino Due with the SAM3x 3.3v chip. I am attempting to communicate with a Digital potentiometer to control an amplifier's volume level but I have no clue how to go about hooking up the 3 wire SPI connection. If I am correct doesn't the Arduino use a 4 wire set up??

I have seen that it is possible from links like this but to be honest with you I don't understand it. Can someone break it down for me and tell me exactly where to plug in the pins for D, RESET(bar), and CLK on the DS1801 into the Arduino Due??

Best Answer

Note this isn't specific to Arduino, but to any SPI master.

Drive DS1801 CLK input from SPI master SCLK output.

Drive DS1801 D input from SPI Master-Out, Slave-In data (may be called MOSI or sometimes DOUT for data output)

The SPI Master-In, Slave-Out data MISO does not need to be connected to anything. You can optionally drive MISO from the DS1801 COUT output: this is the "cascade output" from the internal shift register. The data that appears on COUT is the same data that you originally wrote to D input, but delayed by 16 bits (because DS1801 uses a 16-bit shift register to receive commands from SPI.) With this connection, you can verify in software that the DS1801 device is connected -- this may be useful if it is remote from the SPI master. Otherwise don't worry about it.

Drive DS1801 ~RST input from SPI master CS output, but note this signal is an active-high SPI chip enable rather than the more commonly used active-low chip enable. In software, drive CS high (1) when active just before running the SPI transfer, and then drive CS low (0) when inactive. This is just the opposite of most example SPI code you will find.

Most of the Dallas Semiconductor (now Maxim Integrated) temperature sensors use this active-low Reset / active-high SPI chip select method. It's a little bit unusual, but works just fine.

The Arduino-specific stuff involves calling digitalWrite(slaveSelectPin, HIGH); then SPI.transfer(data); and ending with digitalWrite(slaveSelectPin, LOW);. The Arduino comes with example SPI code, you're welcome to ask follow-up Arduino-specific questions at https://arduino.stackexchange.com/

Full Disclosure: I am an applications engineer and evaluation kits designer at Maxim Integrated; if you have further questions contact our apps team through the Support link on the Maxim Integrated website.

Related Topic