SPI protocol problems with arduino nano

Hello there

I’m working in a project where I have to use SPI protocol to comunicate with a DAC088S085. So, I’m using a arduino nano for the job but it’s not going well so far.

I’m using Arduino version 1.6.8 to program.

This is the code I’m using to for a test but it is not working. When i measure the DAC’s output there is nothing going on.


#include “SPI.h”

#define DATAOUT 11 //MOSI
#define DATAIN 12 //MISO - not used, but part of builtin SPI
#define SPICLOCK 13 //sck
#define SS 10 //ss

void setup() {
// put your setup code here, to run once:
SPI.begin();

pinMode(DATAOUT, OUTPUT);
pinMode(DATAIN, INPUT);
pinMode(SPICLOCK, OUTPUT);
pinMode(SS, OUTPUT);

digitalWrite(SS,HIGH);

SPCR = (1<<SPE)|(1<<MSTR)|(1<<CPHA);

delay(10);

digitalWrite(SS ,LOW);
SPI.transfer(0x0FF0);
SPI.transfer(0x1C00);
SPI.transfer(0x2800);
SPI.transfer(0x3400);
digitalWrite(SS,HIGH);

delay(10);

digitalWrite(SS ,LOW);

SPI.transfer(0xA00F);

digitalWrite(SS,HIGH);

}


In the picture you can see the circuit, blue line is ground and red line 5v.

here is the DAC’s datasheet http://www.ti.com/lit/ds/symlink/dac088s085.pdf

I really need help cause I’m running out of time.

thank you in advance.

void loop() {
  // put your main code here, to run repeatedly:

     setup;

That code does nothing at all useful.

AWOL thanks for the reply. My bad, that was there by mistake. But still, doesn't hurt the program just the brain =)

. . . and now you've edited the original post (but still left out the code tags), and we can't see what was there.

I wish you good luck, I'm out.

I don't really understand what are you trying to tell me. The only code I need for the test is the one on the post. I only need to run that code once.

but thank you anyway.

If you edit the history of a thread it means many comments will be confusing and meaningless
and make their authors look stupid, when it was your fault.

Cosmetic enhancements are OK, but don't destroy the logic of the storyline.

Something helpful anyone...

it's not going well so far

it is not working

Something more helpful?