The TCA9546A is a 4-channel, bidirectional translating switch for I 2 C buses that supports Standard-Mode (100
kHz) and Fast-Mode (400 kHz) operation
TCA9546A是一个4频道双向传输的i2c复用芯片,可以支持标准的100KHZ和高速传输的400KHZ.
The TCA9546A features I 2 C control using a single 8-bit control register
in which the four least significant bits control the enabling and disabling of the 4 switch channels of I 2 C data flow
TCA9546A使用一个8位的控制寄存器,其中的低4位来控制开关这4路i2c数据流频道.
The connections of the I 2 C data path are controlled by the same I 2 C master device that is switched to
communicate with multiple I 2 C slaves. After the successful acknowledgment of the slave address (hardware
selectable by A0 and A1 pins), a single 8-bit control register is written to or read from to determine the selected
channels
A0和A1是硬件连接,如果接地那么就全是0.
由于我遇到的情况,A2,A1,A0均接地,所以slave address = 0xE0.
下表是控制寄存器的情况.
0x01 channel0
0x02 channel1
0x04 channel2
0x08 channel3
当需要使用channel 0时,首先需要:
发送 tca9546a 的slave address: 0xE1(写模式).
然后发送Control register : 0x1.
然后再使用正常的i2c写,比如这个时候你连接的是一个camera sensor, slave 地址是0x70, 这个时候使用你当前芯片的正常写i2c的步骤即可.只是需要在执行之前设置好tca9546a的channel,好让它知道当前是使用哪个channel.
当你需要读设备的寄存器时,同样, 需要先发送:
tca9546a的slave address :0xE1(读模式),然后发送
0x1,选择channel.
然后调用当前芯片的i2c读api函数.