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.

working with PCA9545A

Other Parts Discussed in Thread: PCA9545A

Myself Sojan Francis and I am totally new to the I2C environment.

I am using the PCA9545A (4 channel) switch to downstream the communication from a single master to different channels. The switch is the only slave connected directly to master and all other devices are connected through the switch.

As per data sheet of the PCA9545A, after writing the control word to select the channel, stop cycle must be placed in the bus to activate the selection. Naturally start cycle and address of switch wil come next.

My question is if I send the data bytes now, will they go through the selected channel and reach the connected devices? In other words, will the channel selection remain valid after the Start cycle? 

  • Hi Sojan,

    Yes, the channel selection will remain the same until you change it and/or if there is a valid reset condition ( i.e. power-up, assert on RESET pin).

    Jim

  • Hi Jim,

    Thanks for the help.

    Can you also tell me how to change the channel selection without reseting?

    SOJAN

  • Hi Sojan,

    The PCA9545A is basically just another slave on the I2C bus.  The two address pins allow you to set a unique slave address for this device.

    To change the channel selection, you simply need to address this device again and change the control register to your desired channel selection.  As before, the change will occur as soon as you complete the transaction w/ the stop bit.

    Best Regards,

    Jim

  • Let me elaborate.

    My system include a master to which the switch (PCA9545A) is attached. To each channel of the switch, eight I2C devices (IO expander) are connected. Each of these expanders have multiple registers to be programmed.

    After a start bit, address of PCA9545A is sent.

    According to the datasheet, the next byte transferred after addressing will be stored in control register to select the channel and control register is not given any specific address.  Then with stop bit, the selection is activated.

    Now the master send the start bit and the address of the switch as per normal I2C communication.

    The next byte I am sending needs to travel through the selected channel and activate the desired IO expander.   For this to happen, the earlier channel selection should still be valid despite the start bit. From your earlier reply, I understand that it will. Next two bytes transferred will be the address of a register in the IO expander and the value to be written into it.

    Now to continue the data transmission to different registers of the same IO expander without releasing the control of the bus, I may use the sequence : repeat start bit, expander address, register address & data byte.

    At this moment, I wish to communicate with an IO expander in a diffrerent channel of the switch. Now will the following sequence select a different channel ? 

    Sequence :  repeat start bit, switch address, byte (control word for selecting desired channel) & stop bit.

    Regards and Thanks

    SOJAN

  • There is a correction in my earlier post.

     I believe the correct sequence to continue the data transmission to different registers of the same IO expander without releasing the control of the bus is : repeat start bit, switch address, address of register in expander & data byte.

    At this moment, I wish to communicate with an IO expander in a diffrerent channel of the switch. How can I proceed?

    Regards and Thanks,

    SOJAN

  • Hi Sojan,

    You were actually right the first time :)

    To communicate w/ the currently selected expander, it would be: start, expander address, address register in expander, data byte, stop

    To change the switch to a different channel, it would be: start, switch address, control register data, stop

    I believe the confusion here is that somehow the switch address would need to be included in the transaction in order to communicate with devices on the other side of the switch.  However, that is not the case; after the proper channel selection, the switch becomes transparent to the bus and so you simply need to communicate w/ the devices on the selected channel as if the switch was not there at all.

    Best Regards,

    Jim

  • Hi Jim,

    I am extremely thankful to you for taking up this issue and helping me out of it.

    This is the first time I am interacting in a support forum of this kind and I found it very satisfying.

    Thank You very much for your continuous and patient support.

    Regards and Thanks,

    SOJAN