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.

TCA9543A: Check general understanding of software to use the device

Part Number: TCA9543A

Tool/software:

I am evaluating the TCA9543A to allow us to connect several load cells that have the same I2C address to a BeagleBone Black MCU.

I'd like to confirm my general understanding of the software to use the device.  I'll be writing in C on a Linux system but this is just a pseudocode description.

HW Config is Load Cell 1 is on channel 0 of the IC and Load Cell 2 is on channel 1 of the IC.  Both load cells have I2C address 0x28.

The TCA9543A is out of the box at address 0x70.  

Code steps are

1. Set up BeagleBone Black I2C bus

2. Confirm TCA9543A is at address 0x70.

3. To read load cell 1 on channel 0, enable channel 0 by writing 0x01 to the I2C bus.

4. Read load cell 1, read from address 0x28 (the same way I would if it was directly connected to the BeagleBone's I2C bus.)

5. To next read load cell 2, enable channel 1 of the TCA9543A by writing 0x10 to the I2C bus.

6. Read load cell 2, read from address 0x28 (again, the same way I would if it was directly connected to the BeagleBone's I2C bus.).

In general, is the logic to use this device?

Finally, one other question, what is the relationship between the Address lines on the chip and it's I2C address?  I don't see anything that provides this in the documentation.  So if I wanted the address of the TCA9543A to be 0x71 for example, how does that work?  Do I just tie A0 to Vcc and A1 to ground?

Thanks in advance!

  • The second channel is enabled by writing 0x02 to device address 0x70.

    For the address, see section 8.6.1 of the datasheet.

  • Good catch.  Copy and paste bit me there.   Are these steps generally correct then?

  • So, I'm working with this device via a board from Mikroe called the I2C Mux 4 Click. I know TI does not support other products, but I have a couple of questions about the TCA9543A, which is on the board.

    I can see the TCA9543A at address 0x70; my writing to it using C was successful. I can write 0x01, 0x02, and 0x99, all successfully. (0x99 is just a test value; I realize that's not a valid setting.   )

    Once I send a valid channel select value, like 0x01, I do not see the load cell at 0x28 as expected.  I do not have INT or RST connected to anything.  Do they have to be?  I have tried tying them high and low, and the result has no difference.

    I have directly connected bot the TCA9543A (address 0x70) and the load cell (address 0x28) to the I2C bus and I can read both of them successfully so I know that the load cell works and the wiring is good to the load cell.

    Here is my C code in case it's helpful.

    // Basic & generic includes
    	
    	#include <stdio.h>
    	#include <unistd.h>
    	#include <string.h>
    	#include <stdlib.h>
    	#include <fcntl.h>
    	
    	// includes for time
    	#include <time.h>
    	#include <sys/time.h>
    
    	// includes for I2C
    	
    	#include <linux/i2c-dev.h>
    	#include <sys/ioctl.h>
    
    	int main()
    	{
    	    
    		  int fd2;
    		  int fd1;
    		  
    		  int args;
    		  int x;
    		  
    		  char buf[3];
    	      // clear buffers
    			
    		  buf[0] = 0x00;
    		  buf[1] = 0x00;
    		  int result;
    		
    	// Configure BeagleBone
    	
    		system("config-pin P9_19 i2c");  // reserved for I2C bus, SDA /dev/i2c-2
        	system("config-pin P9_20 i2c");  // reserved for I2C bus, SCL /dev/i2c-2
    		system("config-pin P9_26 i2c");  // reserved for I2C bus, SDA /dev/i2c-1
    	    system("config-pin P9_24 i2c");  // reserved for I2C bus, SCL /dev/i2c-1
    	
    	    usleep(200000); 
    	  
    	
    		if ((fd2 = open("/dev/i2c-2", O_RDWR)) < 0)
    		
    			{
    		    	printf("Failed to open I2C bus 2.");
    		    	exit(1);
    			}
    			
    		if (ioctl(fd2, I2C_SLAVE, 0x70) < 0) 
    			{
    		    	printf("Failed to acquire bus 2 access and/or talk to slave.\n");
    		    	exit(1);
    			}
    		// Repeat reading every second until CTRL-Break to stop or bus / device unreachable
    		buf[0]  =0x01;
    		buf[1]  =0x01;
    		
    		result = write(fd2,buf,1);
    		
    		if (result != 1)
    		{
    			printf("Unable to write to device on channel.\n");
    			exit(-9);
    		}
    		
    		printf("Result of writing to set channel was %d\n",result);
    		
    		if (ioctl(fd1, I2C_SLAVE, 0x28) < 0) 
    			{
    		    	printf("Failed to acquire bus 2, mux channel 0 access and/or talk to slave.\n");
    		    	exit(2);
    			}
    		
    		while(1) 
    			{
    				
    	        // Drive a reading to start
    			
    			
    			result = read(fd1,buf,1);
    			
    			if (result !=1) //Assume this will return 0 on success
    			{
    				printf("Read_MR command on bus failed. Result=%d\n",result);
    				exit(1);
    			}
    			
    			// wait
    			
    			usleep(500000);
    			
    			if (read(fd1,buf, 2) !=2)
    			{
    				printf("Read_F2 command on bus failed.\n");
    				exit(1);
    			}
    			else
    			{
    				printf("Values read from bus are:%2x %2x\n",buf[0]&0x3F,buf[1]);
    				
    			}
    			
    			
    			}
    }

    With the load cell connected to channel 0, here is the output.

    Result of writing to set channel was 1
    Failed to acquire bus 2, mux channel 0 access and/or talk to slave.
    make: *** [/var/lib/cloud9/common/Makefile:173: start] Error 2

  • Hello Walter,

    1.Based of the datasheet I would say it is best to tie both the Reset and INT pins to VCC through pull up resistors.

    2.Are you seeing something called a NACK bit on the I2C(SDA and SCL) lines when the Load Cell( target device) is not receiving the data from the bus controller?( Would you happen to have any scopeshots of this error occurring? This would be Scope shots  waveforms of the  input signal from the Load Cell (target), and the output signal back to the controller

    Here is a good app note that helps debug I2C.

    I agree with Clemens comments from above and you, me and clemens can work together to help your system.

    Regards,

    Kameron

  • I am not familiar with the details of the /dev/i2c interface. It would be easier to use the tools in the i2c-tools package, e.g., "i2cset 2 0x70 0x01".

  •   

    FYI - I double-checked that my connections are good in case one of the jumper wires is bad.  They are all good.

    The first image is a scope capture of the write to set the channel to 0.  It seems to be correct and a good signal.

    I used the Linux command

    i2cset -y 2 0x70 0x01

    to select channel 0.  It did not generate any errors.

    The next image is the scope capture of the command sent to read the load cell at 0x28.  It is connected to channel 0.   

    This is done with the Linux command 

    i2cget -y 2 0x28

    Linux responded with

    Error: Read failed.

    I left the load cell connected to channel and use the following command to set the channel of the mux to channel 1.

    i2cset -y 2 0x70 0x02

    And the scope trace is essentially the same as before.

    Then, I tried the read of the load cell again and it failed and there was nothing on the scope. 

    It is not clear if the output channels need a pull-up resistor.  (Remember, the TI IC is on a development board supplied by Mikroe.  I added 10K pull-up resistors from SDA and SCA on channel 0 (where the load cell is connected) to Vdd.  I then used the command line to set the channel to 0 and ran my code again.  I got readings from the load cell!  While the code read the load cell continuously, I used the command line to change the mux channel to channel 1.  When I made the change the load cell reading failed.  So the mux is working.  I need to add the pull up resistors.  Woohoo!

  • Hi Walter,

    Congrats on finding the fix!

    Please let me know if you need any additional help!