Part Number: CC2650
Other Parts Discussed in Thread: TCA9544A,
Dear community
I use CC2650. I would like to connect to TCA9544A and select channel 0. I use the TI RTOS I2C driver library to implement I2C communication (I2CCC26XX.c/h) between CC2650 and TCA9544A.
A BME280 sensor with slave address 0xEC is connected on TCA9544A
Here is my implementation:
/* a0, a1, and a2 are tied to GND. The address of the device will be: 111 0000 or 0x70 */
#define TCA9544A_SLAVE_ADDR 0x70;
I2C_Transaction masterTransaction;
uint8_t slaveAddr = TCA9544A_SLAVE_ADDR;
/* write slave address + R/W. We want to write. R = 1, W = 0. We write slaveAddr + 0 = 1110000 0 = 0xE0 */
uint8_t wdata = 0xE0;
uint8_t rxBuffer[1];
uint8_t txBuffer[1] = {wdata};
masterTransaction.writeCount = 1;
masterTransaction.writeBuf = txBuffer;
masterTransaction.readCount = 0;
masterTransaction.readBuf = NULL;
masterTransaction.slaveAddress = slaveAddr;
/* 1. Write wdata = 0xE0 to TCA9544A */
bool op_succ = I2C_transfer(i2cHandle, &masterTransaction); // lib function from I2CCC26XX.c
/* 2. Select channel 0.
* |INT3|INT2|INT1|INT0|B2|B1|B0|
* | X | X | X | X |1 |0 |0 |
* We will write 0x04 to control register
*/
wdata = 0x04;
txBuffer[0] = wdata;
/* 3. Write wdata = 0x04 to TCA9544A to select channel 0 */
op_succ = I2C_transfer(i2cHandle, &masterTransaction);
// Read data from BME280
slaveAddr = BME280_SLAVE_ADDR;
//read register part id
txBuffer[0] = BME280_REG_PART_ID;
masterTransaction.writeCount = 1;
masterTransaction.writeBuf = txBuffer;
masterTransaction.readCount = 1;
masterTransaction.readBuf = rxBuffer;
masterTransaction.slaveAddress = slaveAddr;
Unfortunately, the communication to the TCA9544A does not work and I cannot select in this way channel 0. Can please someone help me?
Regards
Volatile