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.

TCA9548A: 硬件中,这个芯片选择通道后就相当于是一根导线了吗?比如,如下

Part Number: TCA9548A

我在硬件中利用I2C协议配置这款芯片

我首先在I2C总线上写       S(起始信号)   1110110(设备ID+写指令)    A(应答信号)     00100000(写入寄存器的值,即进行片选)     A(应答)      P(终止信号)       

写完后相当于写了寄存器,选择了第6个通道

那我接下来写的数据就按第六通道所接的芯片的i2c数据格式要求去写??      也就是接下来写的数据中的设备ID是这个芯片的ID?还是第6通道所接芯片的ID呀??

  • 您好

    关于TCA9548A芯片,当你通过I2C协议配置该芯片并选择了一个通道后,这个通道会被激活,使得与该通道相连的I2C从设备(即你所说的“第六通道所接的芯片”)能够通过这个通道与主控制器进行通信。但说它“相当于一根导线”可能不太准确,因为它还涉及到I2C协议的时序和信号完整性等复杂问题。不过,从功能上来说,你可以理解为在这个通道被选中后,主控制器与该从设备之间的通信就像是通过了一根直接的导线一样。

    对于你提到的I2C协议中的设备ID问题,这里需要明确的是,当你通过TCA9548A选择了一个通道并写入数据时,你实际上是在与TCA9548A进行通信,而不是直接与那个通道的I2C从设备通信。因此,你写入的数据中的设备ID是TCA9548A的ID,而不是那个通道的I2C从设备的ID。但是,一旦TCA9548A的某个通道被选中,并且主控制器开始与该通道的I2C从设备进行通信时,主控制器就需要使用那个从设备的ID来进行通信了。

    所以,在你的例子中,当你通过TCA9548A选择了第六个通道后,接下来你写入的数据应该是按照I2C协议的要求,与TCA9548A进行通信,以确保通道选择正确。但是,当你开始与第六通道所接的I2C从设备进行通信时,你就需要使用那个从设备的ID了。

    www.ti.com/.../tca9548a.pdf

    详细说明请参考datasheet以下部分说明:

    The TCA9548A has a standard bidirectional I 2C interface that is controlled by a master device in order to be configured or read the status of this device. Each slave on the I 2C bus has a specific device address to differentiate between other slave devices that are on the same I 2C bus. Many slave devices require configuration upon startup to set the behavior of the device. This is typically done when the master accesses internal register maps of the slave, which have unique register addresses. A device can have one or multiple registers where data is stored, written, or read. The physical I 2C interface consists of the serial clock (SCL) and serial data (SDA) lines. Both SDA and SCL lines must be connected to VCC through a pull-up resistor. The size of the pull-up resistor is determined by the amount of capacitance on the I 2C lines. (For further details, see the I 2C Pull-up Resistor Calculation application report. Data transfer may be initiated only when the bus is idle. A bus is considered idle if both SDA and SCL lines are high after a STOP condition (See Figure 7 and Figure 8). The following is the general procedure for a master to access a slave device: 1. If a master wants to send data to a slave: – Master-transmitter sends a START condition and addresses the slave-receiver. – Master-transmitter sends data to slave-receiver. – Master-transmitter terminates the transfer with a STOP condition. 2. If a master wants to receive or read data from a slave: – Master-receiver sends a START condition and addresses the slave-transmitter. – Master-receiver sends the requested register to read to slave-transmitter. – Master-receiver receives data from the slave-transmitter.

  • 您好,就是我的I2C第一次写时用  TCA9548A的ID,后面跟8bit数据用来选择通道。  然后下次写就直接用 与该通道相连的I2C从设备 的ID,后面跟他的寄存器地址和写入的数据是吧??这两次写之间不需要什么操作了吧???当然每次写都按照I2C协议的要求。

    但是我实际这么去写,发现 第一次写(也就是选通道那次)  没问题,TCA9548A也给出了正确的应答信号 。 然后我按I2C协议的要求第二次去写,写完  与该通道相连的I2C从设备 的ID 后收不到应答信号??  

    前提是设备ID没问题(仔细确认了好几次),I2C的逻辑也没问题(其他芯片上已经使用过)。

  • 您好

    根据datasheet说明这个操作是没有问题,请您查看是否是硬件连接问题。

  • 好的,感谢您的回复