I2C multiplexer and dac interface interface not working?

Hi,

I am using arduino uno, i2c multiplexer PCA9548a and dac ic MCP4725. When i try to interface pca9548a and pcf8574( io expandar) it worked!!

but when i interface dac 4 no's of DAC ic mcp4725( all in same address ) to PCA9548a. it is not working.

Can anyone tell me the example of interface of i2c mux and DAC ic

Thanks in Advance

Alagappan

Adafruit has both, and has software for both and tutorials.
Did you try one DAC ?
It is hard to tell what could be wrong, it could be voltage levels for I2C, powering the modules, your sketch, and so on.

When i tried to interface directly with DAC MCP4725 it was working. but when i use i2c multiplexer PCA9548a inbetween arduino and dac it is not working.

Seems like SCL not generating. On directg interface i dont face any problem. I tried io expander PCF 8574 with pca9548a (mux) , there is no problem. only i use arduino - i2cmux - dac combination there is scl not generating continuously

Thanks

Alagappan

alagappan:
Hi,

I am using arduino uno, i2c multiplexer PCA9548a and dac ic MCP4725. When i try to interface pca9548a and pcf8574( io expandar) it worked!!

but when i interface dac 4 no's of DAC ic mcp4725( all in same address ) to PCA9548a. it is not working.

Can anyone tell me the example of interface of i2c mux and DAC ic

Thanks in Advance

Alagappan

I use three PCA9545AD's to communicate with twelve MMA8451Q (accelerometers), and twelve 24LC32 EEPROMS, all the accelerometers use I2C address 0x1c and the EEPROMs use 0x50.

So to access the correct Accelerometer or EEPROM I have to disable all of the I2C network branches except the one I want. Each of the PCA9545's has it's on I2C address (0x70..0x72).

Each of these PCA9545 has four independent I2C branches, each with its own interrupt line.

To enable a specific branch you send a single byte to the correct multiplexor:

As long as I only enable one branch(channel) at a time, everything works just fine.

Chuck.

in pca9545AD datasheet ,section 6.2.2 says “When a channel is selected, the channel will become active after a STOP condition has been placed on the I2C-bus” - How you wrote this

I wrote address byte(PCA9545), control byte , stop condition and then again start condition and address of DAC and control byte to dac and two byte data.

when i see in proteus i2c debugger, i am getting ack of device connected to channel. but immediate after ack bus hangs and entire rest of the sketch not working.

alagappan:
in pca9545AD datasheet ,section 6.2.2 says “When a channel is selected, the channel will become active after a STOP condition has been placed on the I2C-bus” - How you wrote this

I wrote address byte(PCA9545), control byte , stop condition and then again start condition and address of DAC and control byte to dac and two byte data.

when i see in proteus i2c debugger, i am getting ack of device connected to channel. but immediate after ack bus hangs and entire rest of the sketch not working.

My code to access a EEPROM on channel 1 of PCA9545A (0x70) is:

void activateBranch(uint8_t hub, uint8_t branch){ //branch is 0..3
Wire.beginTransaction(hub);
Wire.write((byte)1<<branch);
Wire.endTransmission();
}

void deactivateBranches(uint8_t hub){ // disable all branches
Wire.beginTransaction(hub);
Wire.write((byte)0);
Wire.endTransaction();
}

bool isReady(uint8_t i2cAddress){ // if i2c device does not answer it is busy or
// not connected to bus
// function loops until ready or 1 second has elapsed 
unsigned long timeout=millis();
bool ready=false;
do{
  Wire.beginTransaction(i2cAddress); 
  ready = Wire.endTransaction();
  }while((mills()-timeout<1000)&&(!ready));

return ready;
}

bool writeEEPROM(uint8_t hub, uint8_t branch, uint16_t addr, uint8_t data){
activateHub(hub,branch);
bool succeeded;
if isReady(0x50) { // EEprom is ready to accept write
  Wire.begin((byte)0x50);// fixed address  
  Wire.write((byte)highByte(addr));
  Wire.write((byte)lowByte(addr));
  Wire.write((byte)data);
  succeeded = Wire.endTransmission();
  }
else succeeded = false;
deactivateBranches(hub);
return succeeded;
}

void loop(){
static uint16_t addr=0;
// fill eeprom with ascending sequence
if (!writeEEPROM(0x70, 1, addr, lowByte(addr++))){
  Serial.print(" EEPROM write failed at ");
  Serial.println(addr,DEC);
  delay(200);
  }
if((addr&0x00ff)==0) Serial.print('+'); // after each 256 ,tick
}

Do you have pullups on each branch?

On my main I2C bus I have 4.7k pullups for SCL and SDA, on EACH of my branches I have 50k pullups. When the Branch is disabled, it is disconnected from the main branch(it nolonger has any pullups), without those 50k pullups, the SCLx and SDAx fall to 0v, this causes the next transaction to see an additional bit. It messes up the next transaction. Basically the slave device sees the R/W bit of the I2C address as an ACK/NAK bus collision.

Chuck.