Because of the holidays, TI E2E™ design support forum responses will be delayed from Dec. 25 through Jan. 2. Thank you for your patience.

This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DAC80504EVM: DAC80504EVM - simple SPI coding using Arduino as master

Part Number: DAC80504EVM

Hello everyone,

I am working with DAC80504EVM. I want to establish the basic SPI communication between it and Arduino Uno. Currently, the DAC outputs give the midscale value after power up (GAIN = HIGH (2), REFDIV = HIGH(2), RSTSEL = HIGH, LDAC = HIGH, I have left all the default values for the pins on the board). However, when I send simple code 0x080000 via SPI, in order to write 0 on the DAC0 output, or if I send any other code, the outputs stay the same (midscale level = 1.25V). At one point I have accidentally connected VDD and VIO to 3.3V. Could it be that I damaged the DAC since the output of Arduino pins is 5V?

I am sending you attached the image of circuit and the code that I have been trying out.

// include the SPI library:
#include <SPI.h>

const int slaveSelectPin = 10;
int sensorPin = A0;
int sensorValue = 0;

void setup() {
Serial.begin(9600);
// set the slaveSelectPin as an output:
pinMode(slaveSelectPin, OUTPUT);


// initialize SPI:
SPI.begin();
SPI.beginTransaction(SPISettings(16000000, MSBFIRST, SPI_MODE0));


}

void loop() {

// take the SS pin low to select the chip:
digitalWrite(slaveSelectPin, LOW);


SPI.transfer(0x08);
SPI.transfer(0x00);
SPI.transfer(0x00);


// take the SS pin high to de-select the chip:
digitalWrite(slaveSelectPin, HIGH);

sensorValue = analogRead(sensorPin);
Serial.println(sensorValue*5.0/1023.0);

}

I would very much appreciate it if anyone could tell me if the form of the code that I am sending is correct or how to check if I destroyed the DAC? 

I would appreciate any comment or suggestion.

Kind regards,

Dejana

  • Hi,

    Thanks for writing to us.

    Regarding your question, did you connect digital inputs to 5V level when VIO was connected to 3.3V? Damage is unlikely but I will not rule that out.

    A simple check to do is whats the current drawn from VIO supply?  A higher current than what is in the datsheet definitely points to damage to device.

    Whats the status on the LDAC pin? Is it permanently grounded?

    Can you please send me a scope shots of the SPI communication? Especially CS, SCLK and SDI?

    Regards,

    AK

  • Hi Akhilesh,

    Thank you for answering so quickly.

    VIO was connected to 3.3V while I was using pins of Arduino for SPI.

    First I measured Vio by placing the multimeter in between the 5V pin of Arduino and JP1 Vio pin on the board, while TP8 and TP6 were short circuited. I got the current to be up to 4mA. Then, I separately connected TP8 and TP6 to 5V and measured the current separately in between  5V and TP8 (Vio) and 5V and TP6 (VDD), and I got 1.5uA for Vio current, and up to 4mA for VDD current.

    Also, when I change the value of  RSTSEL pin on the board, it reacts properly with the midscale voltage change.

    LDAC is permanently grounded, tho it behaves the same, whether it is grounded or not.

    Here are the scope shots:

    CLK and SDI

    SDI and CS

    And the photos of how it is actually connected:

    Thank you for your help. I really appreciate it.

    Kind regards,

    Dejana

  • Hi Dejana,

    Somehow I am not able to see your scope shots in this post. Can you repost the same?

    Regarding VIO current, it seems to be fine, should be in the order of uA range, that's what you are observing.

    DAC update is not working may be because of some timing violations, please repost scope shots, I will have a look

    Regards,

    AK

  • Hi Akhilesh,

    Here are the scope shots: Note - I am sending 0x08 via SPI.

    SDI and CS

    SCLK and SDI

    SCLK and CS

    I am not sure why do they look so bad. The clock signal doesn't even have a pulse shape.

    I commented the line in the code: SPI.beginTransaction(SPISettings,MSBFIRST;SPI_MODE0)); and now the SCLK looks like this:

    Kind regards,

    Dejana

  • Hi Dejana,

    From the scope shots its clear that you are giving only 8 clks for the device where as for our device minimum is 24 SCLK, otherwise frame will be ignored.

    A serial interface access cycle is initiated by asserting the CS pin low. The serial clock SCLK can be a continuous or gated clock. SDI data are clocked on SCLK falling edges. A regular serial interface access cycle is 24 bits long with error checking disabled and 32 bits long with error checking enabled, thus the CS pin must stay low for at least 24 or 32 SCLK falling edges. The access cycle ends when the CS pin is de-asserted high. If the access cycle contains less than the minimum clock edges, the communication is ignored. 

    Please give 24bit SPI frame and let me know.

    Regards,

    AK

  • Hi Akhilesh,

    Here:

    CS and SCLK

     

    SDI and SCLK


    CS and SDI


     

    I know it needs 24 bits in order not to be ignored, that is why i was trying to send the code 0x080000 initially.

     

    Kind regards,

     

    Dejana

  • Hi Dejana,

    we need continuous 24bit SPI frame , I can see you are sending data in groups of 8 bits, can you send continuous 24bit SPI frame?

    Regards,

    AK

  • Hi Akhilesh,

    You are right, continuous SPI frame is needed! I am trying to send it via Arduino Uno, but apparently all of the built-in functions are adjusted for sending only one byte at a time. 

    Since I wanted to use this DAC with TMDSEVM6657LS anyways (I wanted to use Arduino first to better understand the SPI communication to this DAC), I will try sending the data with TMDSEVM6657LS directly. Hopefully the problem was with not using the continuous data frame.

    If I need more help with this, I will make a new post for the connection of the TMDSEVM6657LS and DAC.

    Thank you for your heelp, I really appreciate it!

    Kind regards,

    Dejana