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.

[参考译文] DAC8812的输出 IOUTA 和 IOUTB 存在问题

Guru**** 2380860 points
Other Parts Discussed in Thread: DAC8812, OPA2277, DAC8811
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/data-converters-group/data-converters/f/data-converters-forum/1421119/problem-with-output-iouta-and-ioutb-of-dac8812

主题中讨论的其他器件:DAC8812OPA2277DAC8811

número ó n de 压差:DAC8812.

herramienta/软件:

您好!

我对 DAC 输出有一个问题:它始终保持在0伏。 为了提供一些背景信息、我使用 DAC8812和两个 OPA2277 (基于 DAC8811的双极输出电路)对两个双极电压源进行了设计和原型设计。

LDAC#:GPIO04
CS#:GPIO05
GPIO16号:RS
CLK:GPIO18
SDI:GPIO23
MSB: 接地
VDD: ESP32的3、3V
VREFX:2.5V 电源
+VS:10V 电源
-VS:-10 V 电源

Estas son las señales ó n que VEO en el osciloscopio:

第一个信号:
黄色信号:CS#
蓝色信号:CLK



第二个信号:
黄色信号:LDAC#(持续时间大于20 ns)
蓝色信号:CS#


第三个信号:
黄色信号:CLK
蓝色信号:SDI (发送0b1111111111111111)

SPI 通信最初看起来不错、但我不明白输出为什么与0V 不同



/*Demo codes for testing DAC8812*/

#include <Arduino.h>
#include <SPI.h> 


//Full functionality demo code

// DAC8812 Pin Definitions
#define CS_PIN 5      // Chip Select (CS) pin
#define LDAC_PIN 4    // Load DAC (LDAC) pin
#define RS_PIN 16     // Reset (RS) pin

// SPI settings
SPISettings DAC8812_settings(1000000, MSBFIRST, SPI_MODE0);

void setup() {
  // Initialize Serial Monitor for debugging
  Serial.begin(115200);

  // Configure SPI
  SPI.begin();  // Initializes the SPI bus

  // Configure control pins
  pinMode(CS_PIN, OUTPUT);
  pinMode(LDAC_PIN, OUTPUT);
  pinMode(RS_PIN, OUTPUT);
  
  // Set control pins to default states
  digitalWrite(CS_PIN, HIGH);  // CS should be high when not communicating
  digitalWrite(LDAC_PIN, HIGH);  // LDAC high to not update outputs
  digitalWrite(RS_PIN, HIGH);  // RS high to avoid reset


  Serial.println("DAC channels updated!");
}

void loop() {
  // Your main loop code can go here
  //digitalWrite(RS_PIN, HIGH);  // RS high to avoid reset
  programDAC8812(1, 0xFFFF);  // Set channel A to midscale (32768, mid value of 2^16)
 // programDAC8812(2, 0x4000);
  
}

void programDAC8812(byte channel, uint16_t value) {
  uint32_t command = 0x00000;  // Nota: el tamaño debe ser al menos 18 bits, por eso se usa un uint32_t

  // Configure the command based on the selected channel
  if (channel == 1) {
    command = 0b11 << 16;  // Set DAC A (A1:A0 = 01)
  } else if (channel == 2) {
    command = 0b10 << 16;  // Set DAC B (A1:A0 = 10)
  }
  
  // Combine the channel bits with the value
  command |= (value & 0xFFFF);  // Set the 16-bit value

  // Print the full 18-bit command in binary
  Serial.print("Channel: ");
  Serial.print(channel);
  Serial.print(", Value: 0x");
  Serial.print(value, HEX);
  Serial.print(" -> Command: 0b");
  for (int i = 17; i >= 0; i--) {
    Serial.print((command >> i) & 1);
  }
  Serial.println();

  // Begin SPI communication
  SPI.beginTransaction(DAC8812_settings);
  digitalWrite(CS_PIN, HIGH);
  digitalWrite(CS_PIN, LOW);
  // Split the 18-bit command into SPI transfers
  uint16_t firstPart = (command >> 2) & 0xFFFF;  // Extract the upper 16 bits
  uint8_t secondPart = (command & 0x3) << 6;     // Extract the lower 2 bits and shift them

  // Print the parts being transferred
  Serial.print("SPI.transfer16: 0x");
  Serial.println(firstPart, HEX);
  Serial.print("SPI.transfer: 0x");
  Serial.println(secondPart, HEX);

  // Send the data via SPI
  //SPI.transfer16(firstPart);
  uint8_t byte1 = (command >> 10) & 0xFF; // Primeros 8 bits (de B17 a B10)
  uint8_t byte2 = (command >> 2) & 0xFF;  // Siguientes 8 bits (de B9 a B2)
  uint8_t byte3 = (command & 0x3) << 6;   // Últimos 2 bits (de B1 a B0) desplazados a la izquierda

  // Enviar cada parte
  SPI.transfer(byte1);
  SPI.transfer(byte2);
  SPI.transfer(byte3);
  

  digitalWrite(CS_PIN, HIGH);  // End SPI communication
  digitalWrite(LDAC_PIN, LOW);
   // Short delay for LDAC pulse
  digitalWrite(LDAC_PIN, HIGH);
  //digitalWrite(CS_PIN, LOW);
  SPI.endTransaction();
 
}


我希望你能帮我。

此致、Omar

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Omar:  

    数据应按以下方式对齐:  

    3个8位数据包、右对齐。

    此致!

    Katlynne Jones

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    谢谢你。

    我没有考虑正确的位顺序、因此进行了相应的调整。

    已确定的另一个问题是、连接到 DAC 输出端的运算放大器没有负电源。 仅用 DAC 和运算放大器隔离电路无法正常工作、但添加电源后、它开始正常工作。

    此致、
    Omar

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Omar:  

    感谢您的更新、并很高兴您能够解决这两个问题。 如果您遇到任何其他问题、请联系我们。  

    此致!

    Katlynne Jones