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.

DAC81416-08EVM: DAC81416 not outputting expected value when used with Arduino DUE, but gives expected output when using USB2ANY connector and the EVM software

Part Number: DAC81416-08EVM

Tool/software:

Jumper Settings:

J10 - 1-2

J2 - OPEN

J3 - OPEN

J11 - 1-2

J9 - 1-2

J7.1 - OPEN

J7.2 - OPEN

J7.3 - GND

J7.4 OPEN

J7.5 - 5V

J7.6 - GND

J7.7 - 12V

Using Default SPI pins on Arduino DUE

The code used:

#include <SPI.h>

// Define SPI settings
#define DAC_CS_PIN 10       // Chip Select (CS) pin for DAC
#define SPI_CLOCK 1000000   // SPI Clock Speed: 1 MHz
#define SPI_MODE SPI_MODE1  // SPI Mode 1 (CPOL=0, CPHA=1)
// #define RESET 9



void setup() {

  delay(5000);
  // Start Serial for debugging
  Serial.begin(9600);
  Serial.println("Initializing DAC81416...");

  // pinMode(RESET, OUTPUT);
  // digitalWrite(RESET, HIGH); // Set reset alwats high


  // Initialize SPI
  SPI.begin();

  // Configure the CS pin
  pinMode(DAC_CS_PIN, OUTPUT);
  digitalWrite(DAC_CS_PIN, HIGH); // Set CS high (inactive)

  // Start SPI transaction
  SPI.beginTransaction(SPISettings(SPI_CLOCK, MSBFIRST, SPI_MODE));

    // Enable SPI communication
// writeSPI(0X00, 0x0001); // Step 0: Enable SPI communication (SPICONFIG register) 0x030004

  // // Minimum SPI commands to configure and verify the DAC
  writeSPI(0x03, 0x0A04); // Step 1: Power up the DAC81416 (SPICONFIG register) 
   writeSPI(0x04, 0x4F00); // Step 2: Use internal reference (GENCONFIG register)
   //writeSPI(0x06, 0x0000); 
  writeSPI(0x09, 0x0000); // Step 3: Power up all DAC channels (DACPWDWN register)
  //writeSPI(0x0D, 0x0000); // Step 4: Set DAC0-3 voltage range to 5V (DACRANGE0)
  //writeSPI(0x05, 0xFFFF);
  writeSPI(0x10, 0xFFFF); // Step 5: Write full-scale value to DAC0 (DAC0_DATA)
  // writeSPI(0x01, 0x8100);
  // writeSPI(0x01, 0x8100);
  Serial.println("DAC Configuration Complete. Check Output Voltage.");
}

void loop() {
  // // Optional: Write a new value to DAC0 periodically for testing
  // writeSPI(0x10, 0xFFFF); // Write max-scale value to DAC0
  // delay(1000);

  // writeSPI(0x10, 0x0000); // Write min-scale value to DAC0
  // delay(1000);

  // writeSPI(0x10, 0x8000); // Write mid-scale value to DAC0
  delay(1000);
}

// Function to write a 24-bit SPI frame
void writeSPI(uint8_t regAddress, uint16_t data) {
  digitalWrite(DAC_CS_PIN, LOW);   // Pull CS low to start communication
  SPI.transfer(regAddress);        // Send 8-bit register address
  SPI.transfer16(data);            // Send 16-bit data
  digitalWrite(DAC_CS_PIN, HIGH);  // Pull CS high to end communication
}

  • Hi Pranav, 

    Sanjay will review and get back to you soon. Can you elaborate on the unexpected output that you are seeing? Does the output remain at 0V, or give some other voltage? Does the voltage change when you update the code, or does it remain at the same incorrect voltage regardless of the code changing?

    Best,

    Katlynne Jones

  • Hi Pranav,

    Jumper setting looks okay, please confirm the below items - 
    1. J12 setting 
    2. Measured voltage on the EVM HW for the TP4, TP5, TP11, TP12 & TP13.

    Thanks,
    Sanjay