I am trying to talk to an LT1257 using an Arduino Nano Atmega328. I am not using the default slave select pin. I am using pin 5 as chip select for the DAC. The LT1257 data sheet shows this timing diagram. What I inferred from this diagram is that SCLK can be used to clock in the data and it remains in the shift register and is loaded into the DAC register only when Load is pulled low. LT1257 timing diagram

I wrote this snippet to load a 0x0000 to the DAC. However, when I probe the output voltage it is ~1.02V. The DAC uses an internal reference of 2.048V. So I think this must be the default 1/2*FS output when the DAC powers on. Please review my code and point the errors. (At the DAC output I have a 1k resistor connected to ground).

#define SCLK 13
#define MISO 12
#define MOSI 11
#define DAC_LOAD 5

#define DAC_SPI_CLOCK_SPEED 1000000 //Upto 1.4MHz

void setup()

void init()
pinMode(SCLK, OUTPUT);
pinMode(MOSI, OUTPUT);
pinMode(MISO, INPUT);
digitalWrite(SCLK, HIGH);
digitalWrite(MOSI, HIGH);
digitalWrite(DAC_LOAD, HIGH);

void dac_write()
digitalWrite(DAC_LOAD, LOW);
digitalWrite(DAC_LOAD, HIGH);

void loop()
  • Notice that SPI.transfer() transfers one byte (8 bits) only, not 12 as you'd want. – JimmyB Feb 19 '17 at 9:56
  • I tried SPI.transfer16() too and that didn't work either. – user1155386 Feb 19 '17 at 16:47
  • Probably unrelated, but: From the diagram, the clock seems to be idle high => SPI mode 3. Also, what is MISO connected to? If nothing, use or enable a pull-up or -down on that input. – JimmyB Feb 20 '17 at 18:30
  • Plus: Apparently !LOAD must be asserted during the last falling edge of the clock line, see t6 and t7. You'll have a hard time trying that with the hardware SPI. You probably have to go with software bit-banging. – JimmyB Feb 20 '17 at 18:34

I read the LT1257 data-sheet more carefully. There is a pull down nmos at the output of the DAC. So when uninitialized, the output of LT1257 should be ~0V. So the output I was measuring (~1.02V) is spurious. I suspect I damaged the IC. I tried the same code on a different LT1257 and it worked. I can confirm now that this code is working.


For a master to select an SPI slave to transmit data to it [the slave], the Slave Select pin is held low.

  • Do you see any reference to the SS signal in the timing diagram? – JimmyB Feb 20 '17 at 18:35
  • OK. The OP refered to an SPI device with slave select pin and I assumed a standard 4 wire SPI device. The datasheet refers to the protocol as '3 wire cascadable serial'. Anyway, here is description of an apparently successful attempt to interface an LT1257 to an Arduino link – 6v6gt Feb 20 '17 at 21:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.