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.

DAC53701: I2C programming of slave address not working

Part Number: DAC53701
Other Parts Discussed in Thread: PCF8574

Tool/software:

I am having issue with programing new slave address for DAC53701 chips as 3 chips are present on the same I2C bus. I want to program 2 chips to alternate slave address of 0x49 and 0x4a.  0x48 being the default address which I keep for the third chip.

Pins PCF8574_PIN_3, PCF8574_PIN_4 are GPI pins of the two devices, the GPI of third pin is always LOW during programing.

Here is my program to program the first chip i call PULSE device, DAC53701_I2C_ADDRESS_BROADCAST is 0x47 


// set GPI pin low for all devices. for the backup device, by default the GPI pin is low so do nothing

pcf8574_write(hi2c, PCF8574_PIN_3, PCF8574_PIN_LEVEL_LOW);

pcf8574_write(hi2c, PCF8574_PIN_4, PCF8574_PIN_LEVEL_LOW);

// lets program PULSE device

pcf8574_write(hi2c, PCF8574_PIN_3, PCF8574_PIN_LEVEL_HIGH);

i2c_driver_mutex_wait();

buf[0] = REG_CONFIG2;

buf[1] = 0x38;

buf[2] = 0x00;

if(i2c_driver_transmit_it(hi2c, DAC53701_I2C_ADDRESS_BROADCAST , &buf[0], 3) != HAL_OK)

{

Error_Handler();

}

buf[0] = REG_TRIGGER;

buf[1] = 0x04;

buf[2] = 0x00;

if(i2c_driver_transmit_it(hi2c, DAC53701_I2C_ADDRESS_BROADCAST , &buf[0], 3) != HAL_OK)

{

Error_Handler();

}

i2c_driver_mutex_release();

i2c_driver_mutex_wait();

buf[0] = REG_CONFIG2;

buf[1] = 0x40;

buf[2] = 0x00;

if(i2c_driver_transmit_it(hi2c, DAC53701_I2C_ADDRESS_BROADCAST , &buf[0], 3) != HAL_OK)

{

Error_Handler();

}

i2c_driver_mutex_release();

pcf8574_write(hi2c, PCF8574_PIN_3, PCF8574_PIN_LEVEL_LOW);

address_modified = true;

}

if (address_modified)

{

i2c_driver_mutex_wait();

buf[0] = REG_TRIGGER;

buf[1] = 0x00;

buf[2] = 0x00;

if(i2c_driver_transmit_it(hi2c, DAC53701_I2C_ADDRESS_BROADCAST , &buf[0], 3) != HAL_OK)

{

Error_Handler();

}

buf[0] = REG_CONFIG2;

buf[1] = 0x00;

buf[2] = 0x00;

if(i2c_driver_transmit_it(hi2c, DAC53701_I2C_ADDRESS_BROADCAST , &buf[0], 3) != HAL_OK)

{

Error_Handler();

}

buf[0] = REG_TRIGGER;

buf[1] = 0x00;

buf[2] = 0x10;

if(i2c_driver_transmit_it(hi2c, DAC53701_I2C_ADDRESS_BROADCAST , &buf[0], 3) != HAL_OK)

{

Error_Handler();

}

i2c_driver_mutex_release();

Let me know if I am doing anything wrong.

Thanks

  • Hello, 

    This is the sequence I have followed to change the I2C address:

    (0x47, 0xD2, 0x38, 0x00);// set GPI_CONFIG bits [13:11] in address 0xD2 to 0b111 (this enables I2C)
    (0x47, 0xD3, 0x04, 0x00);// set TRIGGER bit 10 in address 0xD3 to 0b1 (enables GPI)
    digitalWrite(DAC2, HIGH);
    0x47, 0xD2, 0xB8, 0x00); // Set address for DAC2 to 0x10
    digitalWrite(DAC2, LOW);
    (0x47, 0xD3, 0x00, 0x10);

    I think in this section you are clearing the GPI_CONFIG field, so the DAC doesn't register that the I2C address write was meant for it even though the GPI pin is high. 

    buf[0] = REG_CONFIG2;

    buf[1] = 0x40;

    buf[2] = 0x00;

    Best,

    Katlynne Jones