I2C multiplexer device confusion

Go To Last Post
12 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello, I need to communicate with 3 batteries through SMBus. I managed to communicate each of them separately one by one. However, I need to communicate with 3 of them, for that I decided to use multiplexer. (These are same kind of batteries so their addresses are same.) The multiplexer I chose is  TCA9546A. http://www.ti.com/lit/ds/symlink/tca9546a.pdf 

 

This is the schematic of it, from its datasheet. 

I have several questions:

1) First one is related to pull up resistor values. I used 20 k resistors as pull ups while I was testing SMBus connection one by one and these 20 k resistors worked. But I know 20 k is too much for I2C so I am planning to use 2 k for I2C side and 20 K for SMBus side. I am planning to use 2 k pull up resistors between master MCU and multiplexer and 20 k resistors betweens 3 slave batteries and multiplexer. Would it work or do I need to use 20 k resistors for everywhere or any other option?

 

2) My second question is related to channel selection. I have read the datasheet but I could not get an answer. I thought I would use A0, A1 and A2 pins to select channel. (i.e. when A0=1, A1=0, A2=0, choose first slave etc.) But in the schematic they grounded these pins... It seems like I need to send I2C data in order to choose channel. In datasheet there is this information: 

 

 

So it confused me a lot. How can I choose related channel through it? If I need to choose channel one for example I want to get SOC information from the first battery, in normal case I send address of the smart battery (0x16) then I send command code (0x0D) then I wait for reception. But with this multiplexer how will I do that? Do I use 0x01 as the address register? Then how will it understand the slave address (0x16) by itself. Can someone please clarify it.. Thanks beforehand.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I2C is a bus, if your batteries can be set to a different address, then they can all live on one I2C bus!

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Disclaimer, I'm not on the right computer to pull up the data sheet for the mux chip.

 

That said, it would appear that the A0, A1, and A2 pins set the address of the Mux chip, for the I2C bus.

One could have up to 8 of these Mux chips on the I2C bus, each with their own hardwired address via the Address bus select lines.

 

To select a channel, within a given Mux chip, one uses the B0-B3 bits within the Control Register.

You will have to read the data sheet carefully, but the concept is to establish comm's with the chip, and then use the B register values to select which channel's data the chip is going to provide when you  do a read command.

 

JC 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the answers I still have some questions ( I am a newbie to all these stuff) In datasheet there is no address given for the multiplexer. Will it be a problem if I directly send data to be transmitted to the chip? So I believe protocol should have been like this:

Send channel selection data to multiplexer (0x01 for first channel lets say) -> Send address of the battery (0x16) -> Send command code for the battery (0x0D for asking SOC) -> receive data from it and read. 

And I am planning to repeat this process for all 3 pins by just changing the channel selection data. Does it sound right?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You are over thinking this!  The TCA9546A address bits set the address of the TCA9546A.  You need to send the TCA9546A the port(s) with which you want to communicate.  See table 1 in the spec.  After that, the TCA9546A is transparent.

 

I would use a 4.7kohm pull up everywhere to start, but the best value is dependent on speed, distance, and other factors.

 

You posted the TCA9546A address above.  It's 0xE0 for a write.

 

In consideration of others, please RTFM!

Last Edited: Wed. Apr 10, 2019 - 02:17 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Okay I believe I got the point, I will follow the same procedure I followed while I was trying to communicate with 1 battery without multiplexer. But.. again there are some unclear points for me. In datasheet it says A0 A1 and A2 bits are used for selecting slave address this slave address represents the multiplexer's address or batteries adresss? They are all slaves. If these bits represent slave address, I cannot communicate with a slave which's address is 0x16 (because only 3 bits I can use A0 A1 A2). If these bits represent multiplexer's address, will I set the batteries address after I get ACK from control register? 

Another unclear point for me, I have 2 buffers I can control : Address and Data. After I get ACK from control register ( I chose channel 1 for example) I set address buffer then set data buffer and transmit that data. However, how this multiplexer is going to understand if my data buffer carry a data to be transmitted or data to change the control register? Sorry for asking the same question again and again but I really cannot get it.

 

EDIT: So I think I get the addressing part: I will ground A0, A1 and A2 pins. So my multiplexer's address will be 0. Then I will set the address buffer to 0 and I will set data buffer to 0x01 (for enabling first channel for example). After this process I will set the adress buffer for my battery which is 0x16 and data buffer to command code. Then I will receive the SOC. So if I use address 0 the data I transmit will let me to choose the channel and if I use address 0x16 (actually anything but 0 ) it will let me to send data to the slave connected to this channel. Am I right?

Last Edited: Wed. Apr 10, 2019 - 02:43 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Try it like this . . .

 

Write 0x01 to address 0xE0.

Communicate with the battery connected to channel 0 as if the multiplexer is not even there.

Write 0x02 to address 0xE0.

Communicate with the battery connected to channel 1 as if the multiplexer is not even there.

Write 0x04 to address 0xE0.

Communicate with the battery connected to channel 2 as if the multiplexer is not even there.

Write 0x08 to address 0xE0.

Communicate with the battery connected to channel 3 as if the multiplexer is not even there.

Repeat as required.

 

In consideration of others, please RTFM!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you jpmargis :))) So if I my address matches with the A0,A1 and A2 pins multiplexer chooses the channel according to the transmitted data. And if address does not match to those pins multiplexer understands that I want to communicate with the slave that is connected to the channel that was chosen. Thank you for your patience appreciate it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

GunkutA wrote:

Thank you jpmargis :))) So if I my address matches with the A0,A1 and A2 pins multiplexer chooses the channel according to the transmitted data. And if address does not match to those pins multiplexer understands that I want to communicate with the slave that is connected to the channel that was chosen. Thank you for your patience appreciate it.

Correct, but do you understand how the TCA9546A addressing works? It's 1110 A2 A1 A0 R/W is what makes up its address.
Alot of I2C devices implement this method of addressing.

Last Edited: Thu. Apr 11, 2019 - 12:30 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yup so I will ground A0 A1 and A2. And since I will not read from MUX I will only use Write bit at the end in this case address will be 0b11100000. Well I will receive data tho, still do I need to set read bit? I will set address and channel then send command code to battery and then I will receive data. In this case do I ever need to use 0b11100001 as mux address? 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

You would only need to read from the mux if you wanted to see what channel it's is currently set to.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Okay Kuch thanks for all the information, appreciate it!