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.
Hi TI's supporters
I'm developping device, use DAC53401 chip (schematic diagram is below)
I try to read DAC_STATUS register(address 0xD0) of DAC53401 but value always is 0xFFFF. (I2C line(SCL, SDA pins is only use for DAC53401).
Time chart I2C bus is show below .
I want to confirm is my schematic diagram correct?? And there is a DAC53401 of sample code?? Can you send me DAC sample code??
Thanks,
Hi,
Schematics looks ok to me. This device uses 7 bit addressing scheme and since A0 is GND, address should be 0x48.
Can you please probe the voltage at node CAP ( pin 4) after power up? It should read between 1.55 to 1.6V
Regards,
AK
Hi, Akhilesh K
Thank you your reponse.
Address 0x48 is MSB of address byte and I addtion R/W bit. Then address byte is 0x90(for send) and 0x91(for read).
I reviewed a hardware, CAP pin(pin 4) of DAC is 1.557V .
Now, I still not read sequence of DAC. Can you help me??
Thanks,
Hi,
This means DAC is powered up correctly.
Can you please share your code? Are you able to write into the device and get the desired output?
Regards,
AK
Hi Akhilesh K,
I programming for a another microcontroller (not Ti's microcontroller).
I begin work with DAC recently, I not writen data to DAC yet, but I think that when power is input, DAC is reset state, I read Status register( command address is 0xD0), result is 0x000C (DAC53401).
But now, result always 0xFFFF.
My code is attached below
Thanks
,
//SDA_D is direction port: 0: output 1: input data = read_dac_i2c(0xD0); // Always 0xFFFF unsigned short read_dac_i2c(unsigned char cmd_byte) { unsigned short data; unsigned char address_byte; unsigned char timeout; unsigned char pos; unsigned char dmy; address_byte = 0x90; // Issue start condition set_i2c_start(); // Send address byte send_byte(address_byte); wait_n_mc(20); //Send command byte send_byte(cmd_byte); SDA_D = 1; wait_n_mc(50); // Start repeat condition set_i2c_start(); // Send address byte for receive address_byte = 0x91; send_byte(address_byte); wait_n_mc(20); // Read the 1st byte data dmy = read_byte(); data = dmy; data <<= 8; wait_n_mc(20); // Read the 2nd byte data dmy = read_byte(); data |= dmy; // Issue stop condition set_i2c_stop(); return data; } void send_byte(unsigned char byte) { unsigned char timeout; unsigned char pos; pos = 0x80; while(pos){ SCL = 0; // SCL is set to Low SCL_D = 0; if(pos & byte){ SDA_D = 1; // SDA is set to High } else{ SDA = 0; // SDA is set to Low SDA_D = 0; } wait_n_mc(SCL_LOW2); pos = pos >> 1; SCL_D = 1; // SCL is set to High wait_n_mc(SCL_HIGH2); } SCL = 0; // SCL is set to Low SCL_D = 0; wait_n_mc(SCL_LOW2); // ACK confirmation SDA_D = 1; // SDA is set to Input SCL_D = 1; // SCL is set to Input wait_n_mc(SCL_HIGH2); timeout = 0; while(SDA == 1){ timeout++; if(timeout > 1){ return 0; } } } unsigned char read_byte() { unsigned char dmy; unsigned char pos; dmy = 0; pos = 0x80; while(pos){ SDA_D = 1; SCL_D = 1; wait_n_mc(SCL_HIGH2); if(SDA){ dmy |= pos; } pos >>= 1; SCL = 0; SCL_D = 0; wait_n_mc(SCL_LOW2); } send_i2c_ack(); // Send ACK return dmy; }
Hi,
After power up, if you are reading 0xD0 as 0x000C its correct. That means your existing code is correct. Can you do power up gain, measure CAP voltage and read the same register again? Also read 0xD1 as a debug.
In both cases please probe SDA and SCL lines to see device acknowledges both i2c transactions.
Regards
AK