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.

DAC6571: interfacing DAC6571 using I2C

Part Number: DAC6571

Tool/software:

Hi All,

I'm trying to interface the DAC6571 using I2C with nxp RT1020 imx.8 processor .

I2c is configuration is like it open drain enabled and 4.7K pull up connected on SDA and SCL pin on Hardware.

I confirmed that the I2C is working properly but chip is giving proper data on Vout pin of chip.

check below code:

#define I2C_SLAVE_DAC6571_ADDR_7BIT 0x4CU//(0x98U >> 1)
#define DAC_MASK_VALUE 0x03FF

// DAC value should be 10 bits, so mask it to ensure it doesn't exceed 10 bits
value &= DAC_MASK_VALUE;

// Prepare the data to be sent in the required format
UINT8 data[2];

data[INDEX0] = (value >> 6) & 0x0F; // Upper 4 bits of the 10-bit value

data[INDEX0] |= 0x00; // for normal operation Set two power-down bits to zero

data[INDEX1] = (value << 2) & MAX_8BIT; // Lower 6 bits of the 10-bit value followed by two don't care bits

// LPI2C master descriptor
lpi2c_master_transfer_t masterXfer = {0};
status_t reVal = kStatus_Fail;
/* subAddress = 0x01, data = g_master_txBuff - write to slave.
start + slaveaddress(w) + subAddress + length of data buffer
+ data buffer + stop*/

masterXfer.slaveAddress = I2C_SLAVE_DAC6571_ADDR_7BIT;
masterXfer.direction = kLPI2C_Write;
masterXfer.data = data; //(0 to 1023)
masterXfer.dataSize = sizeof(data);
masterXfer.flags = kLPI2C_TransferDefaultFlag;

// Send master non-blocking data to slave
reVal = LPI2C_MasterTransferEDMA(I2C_MASTER, &g_m_edma_handle, &masterXfer);
if (reVal != kStatus_Success)
{
return DAC_STATUS_FAIL;
}
// Wait for transfer completed.
while (!g_MasterCompletionFlag)
{
// Do Nothing
}
g_MasterCompletionFlag = false;

With this code dac giving me random values .

The expected output is like on Vout pin i will have to get when i set

value = 0 then Vout should 0V

and  value = 1000 then Vout should 3.3V likewise i want from dac but currently it is not giving proper

Please suggest me ASAP.

for more info please check(nxp community link)

Best reagrds.

Hanmant

  • Hi Hanmant, 

    How have you confirmed that the I2C is working properly? 

    The way you are sending your data in the MSB and LSB is correct. Can you measure the I2C write frame on an oscilloscope or logic analyzer and send a screenshot? 

    What do you mean by the DAC gives random output values? When you increase the DAC code, does the output increase, just to a wrong value? Please share some examples of codes you try to send and the resulting output value. 

    Are you evaluating this on a PCB you designed? If so, please share a schematic. 

    Best,

    Katlynne Jones

  • Hi 

    Yes I checked i2c is working.

    Output of Dac value is not increased when I increase the dac code.

    Suppose if Set

    value = 100 ,Dac gives me like 2.8v

    Value =500 , Dac gives me like 2.8v 

    Value =1020 , Dac gives me like same  2.8v and sometimes it will give 1.3v or 0.8v

    These are type of bahaviour of Dac output 

    (VOUT =VDD * D/1024)

    I able to write value such like1020(0x03FC) and data was acknowledged

  • Please give us solution and also sample codes if you have .

  • Please snippet of schematic

  • Hi Hanmant, 

    The schematic looks ok, and the equation you are using is correct. Are you measuring the DAC output or the op amp output? 

    Can you repeat the I2C command for 0x3FC and also show the analog channels? The logic analyzer is saying the DAC is acknowledging, but it will be easier to confirm this if I can see the analog waveform. 

    Can you measure VDD and make sure it is at a stable 3.3V? 

    Best,

    Katlynne Jones