0

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??

Hooplator15
  • 327
  • 1
  • 8
  • 22
  • Have you compared the timing diagrams yet? – Ignacio Vazquez-Abrams Apr 22 '15 at 02:41
  • I have taken a look at the DS1801 datasheet, it says that it takes 16bits and it looks like 8 bits get dedicated to each of the two resistors. The issue is I am honestly not very familiar with spi. Do I just hook up D to MOSI and CLK to SCL? Then where should I hook up RESET, would that go to CS? – Hooplator15 Apr 22 '15 at 02:47
  • So then is that a no? – Ignacio Vazquez-Abrams Apr 22 '15 at 02:49
  • ... I honestly don't know what timing diagrams you are referring to... the only timing diagram I know of is that of the DS1801 found in the datasheet. Are you saying that SPI interface on the Arduino Due has a timing chart I can refer to? – Hooplator15 Apr 22 '15 at 03:07
  • Dallas Semiconductor (now part of Maxim Integrated) used `~RESET` as an **active-high** SPI chip enable, so you can drive it with SPI CS as long as you drive high (1) when active, and low (0) when inactive. Most SPI peripherals use the opposite, active-low. – MarkU Apr 22 '15 at 04:16

1 Answers1

2

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.

MarkU
  • 14,413
  • 1
  • 34
  • 53
  • Mark, I never expected someone from Maxim themselves to answer. Wow! Thank you! I will give that a try. I am very new at this and the nomenclature of the Maxim serial interface threw me off a little, but it all works the same I suppose. – Hooplator15 Apr 22 '15 at 04:44