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.

Hardware Pins and Device Address on PCA9543A

Other Parts Discussed in Thread: BQ77PL900, PCA9543A

Backstory: Using the bus switch in a routine way.  I2C in from an ATMEGA328 and I2C out to two BQ77PL900 battery protection circuits.  Currently have it planned for the two hardware pins, A0/A1, to be connected to GND.  Also have all the INT going to VCC through a pull-up resistor.  Basically follows the example circuit given in the technical datasheet.

Question: The device address for the switch has bits 1 and 2 assigned for selecting between hardware pins A0 and A1 respectively.  I'm not using either of these so I'm a little confused as to whether I either need to be using them or if I just set them both to 0 when addressing the switch.  It's confusing because you select the channel that selects which I2C device you're talking to when you send the control register after. 

TLDR: What do you do with the hardware pins physically and in the device address?

  • A0 and A1 being grounded will give you a slave address of 1110 000(R/W).

    Most applications that will make use of this feature have multiple PCA9543s to communicate with on the same bus.

    Andrew

  • New question.

    So I'm trying to just test the switch on a breadboard with an Arduino as the master and an oscilloscope to monitor the channels.  When I try my Arduino code I don't read anything on the oscilloscope on either channel.  I'm thinking that it's either that my register addresses are wrong or that perhaps the oscilloscope isn't picking up on the signals.  I tested the oscilloscope with a test code and the oscilloscope read it then so maybe it isn't the problem.

    So the device address is: 11100000

    My register addresses are 1 and 2 for channel 0 and 1 respectively.  Anything wrong with that? Any ideas of what else could be going on?

  • Hello Travis,

    A few questions:

    • Are you able to communicate with the device?
    • What pins is the o-scope monitoring?
    • If you are able to get an ack and write to the device? If so can you change the register settings and read the values back to verify?

    Regards,

    Andrew

  • I haven't checked if I am receiving an ack or not.  I've never had to yet, the only chip I've programmed with is the BQ77PL900 which doesn't ack.  How would I do that?

    The oscilloscope is monitoring pins 5 and 9, the sda of each channel.

  • Here's the code I'm using:

    void writei2c(byte registeraddress, byte datastuff)
    {
      Wire.beginTransmission(B11100000);
      Wire.write(registeraddress);
      Wire.write(datastuff);
      Wire.endTransmission();
     
      Serial.print("Address: ");
      Serial.print(registeraddress, BIN);
      Serial.print("\tValue: ");
      Serial.println(datastuff, HEX);
    }

  • I believe I figured it out on my own! Arduino does the R/W bit automatically and only needs the 7 bit address.  I'll test it here soon.  Thank you for trying to help!

  • Hey Andrew,

    I was hoping you could help me out again.  I've been able to communicate with the switch with the Arduino, the problem is that it's staying on Channel 0 even when I address Channel 1 first.  Like before I'm monitoring the SDATA pins on each channel on the oscilloscope. 

    If you or anyone else looking knows Arduino code, this is what I have setup as of now:

    #include <Wire.h>

    void setup()
    {
      Wire.begin();
      Serial.begin(115200);
    }

    void loop()
    {
      if (Serial.available())
      {
        char c = Serial.read();
        
        if(c == 'a')
        {
          //Write to channel 0
          writei2c(0x01, 1);
        }
        
        if(c == 'b')
        {
          //Write to channel 1
          writei2c(0x02, 1);
        }
      }
    }

    void writei2c(byte channeladdress, byte datastuff)
    {
      //Slave address of PCA9543A
      Wire.beginTransmission(B1110000);
      //Write to control register to select channel
      Wire.write(channeladdress);
      //Wire.beginTransmission(B0010000); would be here if actually talking to BQ
      //Write to the BQ register
      Wire.write((byte)0x00);
      //Write the setting to the BQ register
      Wire.write(datastuff);
      Wire.endTransmission();
     
      //Slave address of PCA9543A
      Wire.beginTransmission(B1110000);
      //Write to control register to reset to default state
      Wire.write(0);
      Wire.endTransmission();
     
      Serial.print("Talking to channel: ");
      Serial.print(channeladdress, BIN);
      Serial.print("\tValue: ");
      Serial.println(datastuff, HEX);
    }

  • Hello Travis,

    Can you modify your code to only use channel 1 like below and see if channel one is still not turning on? 

    void loop()
    {
      if (Serial.available())
      {
        char c = Serial.read();
        
        if(c == 'a')
        {
          //Write to channel 1
          writei2c(0x02, 1);
        }
        
        if(c == 'b')
        {
          //Write to channel 1
          writei2c(0x02, 1);
        }
      }


    Regards,

    Andrew