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.

PCA9545APWR is hanging when a slave is switched OFF

I am using a PCA9545APWR to connect a master I2C from controller to four slave devices mostly sensors. When ever I want to connect to a slave, I command the switch to establish a connection with that slave and disconnect all other slaves. So at any time the switch will be connected to only one slave. When all slave are powered on there is no problem. But when a slave is powered off and if I connect to that slave, from that time onwards the I2C switch is not responding (any attempt to configure the I2C switch ends with no acknowledgement). Please assist us to solve this issue.

  • Hello Sathivel,

    What you're describing is a result of the I2C bus you're connecting being low, which pulls the main bus low. The switch is unable to respond to any commands because the bus is being held low by the slave you connected to.

    In this case, you have 2 options:
    1) Power up the bus that is pulling everything low
    2) Toggle the ~RESET pin low and back high. This will cause the switch to reset, which will disable all channels, and allow you to send commands to the PCA device.

    Do you have a way to check if the bus is high before you command the switch to connect to it?

    Best regards,
    Jonathan
  • No. I don't have any way to check that. The only way is to check for ACK.
  • Sakthivel,

    When you ask the switch to connect a line to the main bus, it will connect it after the stop condition of the request. If the line you are connect is held low, then this low will propagate to the main line. Your SDA/SCL lines will be pulled low by the line you connected. In this case, you cannot send any more commands over the I2C bus due to the way I2C functions (No device can pull the line high, it can only pull the line low or 'release' it and then the pull up resistor will pull it high. This is how bi-directional communication is possible on a single wire). This is why the switch doesn't respond when you send more commands. The bus is held low, so your I2C master isn't able to send any commands out.

    In this situation, your only options are to bring the power rail up so that the SDA/SCL come high and then communication can resume, or you will have to reset the switch (by toggling the RESET pin or cycling the power) which will make it disconnect all downstream busses from the main.

    Depending on what you're using as your I2C master, you should be able to check for SDA being low in a register (the MSP430s do this, for example).

    I would implement something similar to this logic to check for this situation:
    1) Request to the I2C switch to connect a slave channel.
    2) Once you've received the ACK from the I2C switch, the slave channel should be connected. Check I2C registers for if the I2C bus is held low, if it is go to step 3a. If it is not, go to step 3b
    3a) Assume that slave power rail is off, causing bus latch up condition, toggle reset pin on switch
    3b) Assume slave power rail is on, communicate with slave.