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.

DAC80004: DAC80004

Part Number: DAC80004

Hallo everyone

I need some help programming the DAC80004.

I use the SPI-Bus to communicate with the chip.

I use the datasheet www.ti.com/.../dac80004.pdf

I have no problems writing and getting data form the chip.

But I have to update all 4 DAC-channels at one time synchronous.

I tried setting and reseting the LDAC- and the SDO-register.

I tried sending and not sending the LDAC-signal at the end of the message.

I tried to send two messages (2x4byte) in one SYNC-time.

I tried sending LDAC-signal in the middle of the message as it is mentioned at page 8.

I tried using different Command Bits (0-3 Bit D27-D24).

And all of this in combination.

Every time the data is updated after each message (4 bytes).

Is it possible to write in each buffer of each channel first and update it afterwards ???

how dose the correct procedure look like?

one my routine: (I tested is without the leds also)

software LDAC is a byte I can set by my own

uint8_t SPI_send_data(uint8_t v0,uint8_t v1,uint8_t v2,uint8_t v3)
{
  uint8_t ret_wert=0;
  // ChipSelect auf Lo
  CS(Bit_RESET);

  UB_SPI2_SendByte(v0);
  UB_SPI2_SendByte(v1);
  UB_SPI2_SendByte(v2);
  ret_wert=UB_SPI2_SendByte(v3);

    CS(Bit_SET);
    if (softwareLDAC == Bit_SET)
    {
        LDAC(Bit_RESET);
        LDAC(Bit_SET);
    }

    if (softwareLDAC == Bit_SET)
    {
        UB_Led_On(LED_GREEN);
        UB_Led_Off(LED_RED);
    }
    else
    {
        UB_Led_Off(LED_GREEN);
        UB_Led_On(LED_RED);
    }

  return ret_wert;
}

Seding routines. dacCommand can change in it varios ways.

    SPI_send_data(dacCommand,0x0F,0xFF,0xF0);
    delayms(100);
    SPI_send_data(dacCommand,0x1F,0xFF,0xF0);
    delayms(100);
    SPI_send_data(dacCommand,0x2F,0xFF,0xF0);
    delayms(100);
    SPI_send_data(dacCommand,0x3F,0xFF,0xF0);
    delayms(100);

Init routine

0x08,0x00,0x00,0x02  :enable SDO,  retval=0x2              
0x04,0xF0,0x00,0x0F  :Power on,  retval=0x2
0x06,0xF0,0x00,0x0F  :update control,  retval=0x3e
0x1d,0x00,0x00,0x00  :reading status register,  retval=0x7c
0x05,0x00,0x00,0x02  :clear mode register,  retval=0x0

  • Hi Christoph,

    It looks like you are setting the LDAC bits in your init routine to 1, so the HW LDAC is ignored and the DACs will automatically update when new values are written to the device. If you want to use synchronous updates, you need to set these bits to 0.

    If you want to use the Hardware LDAC, then you need to need to use command 0x0 (D27-24) to update the buffers of each DAC, then assert the LDAC pin. If you are using the Software LDAC, then use command 0x0 to update 3 of the DAC buffers, then command 0x2 to update the final DAC buffer and initial the SW LDAC.

    That should give you the synchronous update your are looking for.

    Please let me know if this solved your problem or if you have any more questions.

    Thanks!
  • That doesn't help very much, have you got some sample code for me?

    Here is my code,

    void software_reset(void)
    {
    dbgMessage("DAC: software reset");
    SPI_send_data(0x07,0x00,0x00,0x00);
    }

    void dac_init_example_from_internet(void)
    {
    uint8_t rval=0;
    dbgMessage("dac_init_example_from_internet");
    delay(10000); rval = SPI_send_data(0x08,0x00,0x00,0x02); //enable SDO - Register
    sprintf(txBUF,"0x08,0x00,0x00,0x02 :enable SDO, retval=0x%x",rval); dbgMessage(txBUF);

    delay(10000); rval = SPI_send_data(0x04,0xF0,0x00,0x0F); //Power on
    sprintf(txBUF,"0x04,0xF0,0x00,0x00 :Power on, retval=0x%x",rval); dbgMessage(txBUF);


    delay(10000); rval = SPI_send_data(0x06,0xF0,0x00,0x00); //update control by the 32 falling edge
    //delay(10000); rval = SPI_send_data(0x06,0xF0,0x00,0x0F); //update control by the 32 falling edge
    sprintf(txBUF,"0x06,0xF0,0x00,0x00 :update control, retval=0x%x",rval); dbgMessage(txBUF);

    delay(10000); rval = SPI_send_data(0x1d,0x00,0x00,0x00);
    sprintf(txBUF,"0x1d,0x00,0x00,0x00 :reading status register, retval=0x%x",rval); dbgMessage(txBUF);

    delay(10000); rval = SPI_send_data(0x05,0x00,0x00,0x02);
    sprintf(txBUF,"0x05,0x00,0x00,0x02 :clear mode register, retval=0x%x",rval); dbgMessage(txBUF);
    }

    void ldac_clear(void)
    {
    dbgMessage("LDAC cleared");
    SPI_send_data(0x06,0x00,0x00,0x00);
    }

    void ldac_read(void)
    {
    dbgMessage("LDAC read");
    uint8_t rval=255;
    rval=SPI_send_data(0x16,0x00,0x00,0x00);

    // sprintf(STRING_BUF,"Reg 0x%0x: 0x%02x DEZ:%04d BIN:"BYTETOBINARYPATTERN,i, I2C1_DATA[i] ,I2C1_DATA[i] ,BYTETOBINARY(I2C1_DATA[i]));

    sprintf(txBUF,"Value of LDAC register: %i, binary: "BYTETOBINARYPATTERN,rval,BYTETOBINARY(rval));
    dbgMessage(txBUF);
    }

    void UB_Led_On(LED_NAME_t led_name)
    {
    ... you dont need this just for debug
    }


    void dbgMessage(char* buf)
    {

    printf etc ... you dont need this, just for debug
    }


    void delayms(int32_t time)
    {

    //you dont need this

    time=time * 8;
    while (1) {
    if(time!=0)
    {
    time--;
    //if ((time % 100000) == 0) UB_USB_CDC_SendString(".",NONE);
    }
    else
    {
    return;
    }
    time++;time--;
    }
    }




    void ldac_action_set_signal()
    {
    dbgMessage("LDAC action");
    LDAC(Bit_RESET);
    LDAC(Bit_SET);
    }



    uint8_t SPI_send_data(uint8_t v0,uint8_t v1,uint8_t v2,uint8_t v3)
    {
    uint8_t ret_wert=0;
    // ChipSelect auf Lo
    CS(Bit_RESET);

    UB_SPI2_SendByte(v0);
    UB_SPI2_SendByte(v1);
    UB_SPI2_SendByte(v2);
    ret_wert=UB_SPI2_SendByte(v3);

    CS(Bit_SET);
    if (softwareLDAC == Bit_SET)
    {
    LDAC(Bit_RESET);
    LDAC(Bit_SET);
    }

    if (softwareLDAC == Bit_SET)
    {
    UB_Led_On(LED_GREEN);
    UB_Led_Off(LED_RED);
    }
    else
    {
    UB_Led_Off(LED_GREEN);
    UB_Led_On(LED_RED);
    }

    return ret_wert;
    }




    //********************************************************************************
    THE ROUTINE I am calling

    void d43_example()
    {
    software_reset();
    dac_init_example_from_internet();
    ldac_clear();
    ldac_read();

    dacCommand = 0x00;

    UB_Led_On(LED_BLUE);
    dbgMessage("DAC Channel to zero");
    SPI_send_data(dacCommand,0x00,0x00,0x00);
    delayms(100);
    SPI_send_data(dacCommand,0x10,0x00,0x00);
    delayms(100);
    SPI_send_data(dacCommand,0x20,0x00,0x00);
    delayms(100);
    SPI_send_data(dacCommand,0x30,0x00,0x00);
    delayms(5000000);
    UB_Led_Off(LED_BLUE);
    ldac_action_set_signal();

    delayms(5000000);

    dbgMessage("DAC Channel to maximum");
    UB_Led_On(LED_BLUE);
    SPI_send_data(dacCommand,0x0F,0xFF,0xF0);
    delayms(100);
    SPI_send_data(dacCommand,0x1F,0xFF,0xF0);
    delayms(100);
    SPI_send_data(dacCommand,0x2F,0xFF,0xF0);
    delayms(100);
    SPI_send_data(dacCommand,0x3F,0xFF,0xF0);
    delayms(5000000);
    UB_Led_Off(LED_BLUE);
    ldac_action_set_signal();
    dbgMessage("d43_example() finished");
    }
  • Hi Vodi,

    Are the DACs not updating simultaneously? I do not see anything wrong with your code, though you could try to check your timing as I do not see any delays in the CS or LDAC assertion. Please look at Figure 1 in the DAC80004 datasheet for minimum timing requirements for the LDAC pin, specifically tD4 and tW4.

    Thanks!
    Paul
  • How this works:
    -clear "LDAC register" (0x6 Bit D27-D24)
    -release JP6 on the evalboard
    -turn SDO to zero (SDO=1 is only for reading)
    -write DAC values with command=0x0 (0x0 Bit D27-D24) "Update to buffer n"
    -send a LDAC-implulse as specified in the manual, for updating all dacs after writing the expected values

    -if its not working check CS and LDAC signals and timings, some µC send the CS-Impulse before finishing transmitting the data to the DAC

    -also check signalquality MISO MOSI etc.

    -also check CPOL CPHA on the SPI-Bus and your Oszi

  • Yes, that is the procedure I would use to verify functionality.
  • Vodi,

    Any updates?
  • any update on this case, I'm facing the same issue.

    Regards.