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.

Switch to slave communication

Other Parts Discussed in Thread: TCA9548A

Hi all,

Please i need some help with my I2C switch communication, i have two I2C devices connected to a channel(01) of the Switch. These devices(EEPROM and Temp. Sensors) have addresses 0x54 and 0x1C respectively. I start by writing the switch address which is 0x70 followed by a read command. I then write(0x01) to the channel registers of the Switch to select channel one. I then write the address of the temperature sensor(0x1C) followed by a register address in the temp. sensor(0x00). when i run this i don't seem to any result. am i sending the right commands the right way? Please what am i doing wrong? 

Help me please...

I2C_start(RFI2C_BASE,0x70,1); // Slave address in write mode
I2C_write(RFI2C_BASE,0x01,1); // write to channel and a stop condition

I2C_write(RFI2C_BASE,0x1C,1); // address of the temp. Sensor (0x1C);

I2C_write(RFI2C_BASE,0x00,0); // register 00 in the temperature sensor

for(i=0; i<18; i++){
//Temp_read_data[i][0] = I2C_read(0x1c,0); // memory read
printf("\n LOCAL Temperature is \t%x\n",I2C_read(RFI2C_BASE,0));
}

//=======output shown below

LOCAL Temperature is  ff

LOCAL Temperature is  ff

LOCAL Temperature is  ff

LOCAL Temperature is  ff

//========================

  • Hi Natty,

    What I2C switch are you using currently? It may be easier to help debug if I know the device you're using.

    Thanks,
    Siby
  • Okay Siby. Thank you in advance. I am using the TCA9548APW 1 to 8 switch from TI. and i have the details as as shown here again


    copied from earlier

    Please i need some help with my I2C switch communication, i have two I2C devices connected to a channel(01) of the Switch. These devices(EEPROM and Temp. Sensors) have addresses 0x54 and 0x4C respectively. I start by writing the switch address which is 0x70 followed by a read command. I then write(0x01) to the channel registers of the Switch to select channel one. I then write the address of the temperature sensor(0x4C) followed by a register address in the temp. sensor(0x00). when i run this i don't seem to any result. am i sending the right commands the right way? Please what am i doing wrong?

    Help me please...

    I2C_start(RFI2C_BASE,0x70,1); // Slave address in write mode
    I2C_write(RFI2C_BASE,0x01,1); // write to channel and a stop condition

    I2C_write(RFI2C_BASE,0x4C,1); // address of the temp. Sensor (0x1C);

    I2C_write(RFI2C_BASE,0x00,0); // register 00 in the temperature sensor

    for(i=0; i<18; i++){
    //Temp_read_data[i][0] = I2C_read(0x1c,0); // memory read
    printf("\n LOCAL Temperature is \t%x\n",I2C_read(RFI2C_BASE,0));
    }


    //=======output shown below

    LOCAL Temperature is ff

    LOCAL Temperature is ff

    LOCAL Temperature is ff

    LOCAL Temperature is ff

    //========================

    Regards
    Natty

  • Hi Natty,

    Thank you for providing that. It looks like you may not actually be writing to these devices after your read of the I2C switch. Have you tried changing the R/W bit back to 0 after your read of the TCA9548A?

    Thanks,
    Siby
  • Yes Siby!!
    Thank you very much. I got it running now. I needed to send(write) some pointer settings prior to the read command, indicating which register i want to read from. Thanks for the help once again, greatly appreciated.


    Natty
  • You're welcome!

    Glad it's up and running.

    Thanks,
    Siby