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.

DAC81416EVM: Unable to send data continuously

Part Number: DAC81416EVM

I'm trying to use Arduino SPI communication to control DAC81416EVM, but when I trying send several data, it didn't change output, always output 5V.

Connection:

Arduino SCK -> J8.8

Arduino MISO -> J8.3

Arduino MOSI -> J8.4

Arduino SS -> J8.2

Vcc -> 15V from power supply

VDD/VAA -> 5V from power supply

VIO -> 5V from Arduino

VSS -> GND

J10 -> 2-3

Arduino code:

void setup() {
Serial.begin(115200);
SPI.beginTransaction(SPISettings(100000, MSBFIRST, SPI_MODE1));
SPI.begin();
delay(100);


// Set DAC[15:12] range 0-5V//
digitalWrite(SS, LOW);
dac_write(R_DACRANGE0);
SPI.transfer(0x00);
SPI.transfer(0x00);
digitalWrite(SS, HIGH);
delay(100);

// Set DAC[11:8] range 0-5V//
digitalWrite(SS, LOW);
dac_write(R_DACRANGE1);
SPI.transfer(0x00);
SPI.transfer(0x00);
digitalWrite(SS, HIGH);
delay(100);

// Set DAC[7:4] range 0-5V//
digitalWrite(SS, LOW);
dac_write(R_DACRANGE2);
SPI.transfer(0x00);
SPI.transfer(0x00);
digitalWrite(SS, HIGH);
delay(100);

// Set DAC[3:0] range 0-5V//
digitalWrite(SS, LOW);
dac_write(R_DACRANGE3);
SPI.transfer(0x00);
SPI.transfer(0x00);
digitalWrite(SS, HIGH);
delay(100);

//enable SDO for SPI read//
digitalWrite(SS, LOW);
dac_write(R_SPICONFIG);
SPI.transfer(0x0A);
SPI.transfer(0x84);
digitalWrite(SS, HIGH);
delay(100);

// Power up all channels//
digitalWrite(SS, LOW);
dac_write(R_DACPWDWN);
SPI.transfer(0x00);
SPI.transfer(0x00);
digitalWrite(SS, HIGH);
delay(100);

// Enable broadcast//
digitalWrite(SS, LOW);
dac_write(R_BRDCONFIG);
SPI.transfer(0xFF);
SPI.transfer(0xFF);
digitalWrite(SS, HIGH);
delay(100);

//Set all channels to asynchronous mode//
digitalWrite(SS, LOW);
dac_write(R_SYNCCONFIG);
SPI.transfer(0x00);
SPI.transfer(0x00);
digitalWrite(SS, HIGH);
delay(100);

}

void loop() {

while(1)
{
// write code to R_BRDCAST
digitalWrite(SS, LOW);
dac_write(R_BRDCAST);
SPI.transfer(255);
SPI.transfer(255);
digitalWrite(SS, HIGH);
delay(500);

// write code to R_BRDCAST
digitalWrite(SS, LOW);
dac_write(R_BRDCAST);
SPI.transfer(0);
SPI.transfer(0);
digitalWrite(SS, HIGH);
delay(500);

}

delay(300);

}

void dac_write(int dac_reg)
{
int dac_regW = dac_reg | 0x00;
SPI.transfer(dac_regW);
}

  • Sanjay will help with this.

  • Hi Ching-Yun Lee,

     

    Can you please provide the  sequence of "register names" and data written in the corresponding resister?

     

    Thanks,

    Sanjay

  • // Registers//
    #define R_NOP 0x00
    #define R_DEVICEID 0x01
    #define R_STATUS 0x02
    #define R_SPICONFIG 0x03
    #define R_GENCONFIG 0x04
    #define R_BRDCONFIG 0x05
    #define R_SYNCCONFIG 0x06
    #define R_TOGGCONFIG0 0x07 //DAC[15:8] Toggle Configuration Register//
    #define R_TOGGCONFIG1 0x08 //DAC[7:0] Toggle Configuration Register//
    #define R_DACPWDWN 0x09 //when it set up on 1 is off//
    #define R_DACRANGE0 0x0A //DAC[15:12] Range Register//
    #define R_DACRANGE1 0x0B //DAC[11:8] Range Register//
    #define R_DACRANGE2 0x0C //DAC[7:4] Range Register//
    #define R_DACRANGE3 0x0D //DAC[3:0] Range Register//
    #define R_TRIGGER 0x0E
    #define R_BRDCAST 0x0F
    #define R_DAC0 0x10
    #define R_DAC1 0x11
    #define R_DAC2 0x12
    #define R_DAC3 0x13
    #define R_DAC4 0x14
    #define R_DAC5 0x15
    #define R_DAC6 0x16
    #define R_DAC7 0x17
    #define R_DAC8 0x18
    #define R_DAC9 0x19
    #define R_DAC10 0x1A
    #define R_DAC11 0x1B
    #define R_DAC12 0x1C
    #define R_DAC13 0x1D
    #define R_DAC14 0x1E
    #define R_DAC15 0x1F
    #define R_OFFSET0 0x20 //DAC[14-15;12-13] Differential Offset Register//
    #define R_OFFSET1 0x21 //DAC[10-11;8-9] Differential Offset Register//
    #define R_OFFSET2 0x22 //DAC[6-7;4-5] Differential Offset Register//
    #define R_OFFSET3 0x23 //DAC[2-3;0-1] Differential Offset Register//

    The SPICONFIG set to 0x0A84

    DACPWDWN set to 0x0000

    SYNCCONFIG set to 0x0000

    I want to write data to the register BRDCAST, and let it output a square wave, like 0xFFFF->0x0000->0xFFFF->0x0000

    Thanks

  • Hi Ching-Yun Lee,

     

    Can you please tell me how the DAC reference() is being brought up, is it internal or external ? If there is no reference is connected on the REF pin of the DAC, then please follow sequence provided below - 

    SPICONFIG >> 0x0A84

    GENCONFIG >> 0x0100 

    BRDCONFIG >> 0xFFFF

    DACPWDWN >> 0x0000

    SYNCCONFIG set to 0x0000

    BRDCAST >> 0xFFFF Arrows clockwise 0x0000

      

    Thanks,

    Sanjay

  • Hi Sanjay,
    I didn't set up the DAC reference, when I set GENCONFIG >> 0x0100 it's executing well, that is help me a lot, thank you.