• AVR Freaks

AnsweredHot!I2C multiplexer channel selection and pull up resistor confusion

Author
GunkutA
Junior Member
  • Total Posts : 107
  • Reward points : 0
  • Joined: 2019/01/10 00:09:38
  • Location: 0
  • Status: online
2019/04/10 06:29:48 (permalink)
0

I2C multiplexer channel selection and pull up resistor confusion

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. ( I cannot add datasheet or link of it because site gives me error unfortunately.)
I added the schematic of it from its dahasheet.
 
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.
post edited by GunkutA - 2019/04/10 06:37:55

Attached Image(s)

#1
qhb
Superb Member
  • Total Posts : 9979
  • Reward points : 0
  • Joined: 2016/06/05 14:55:32
  • Location: One step ahead...
  • Status: online
Re: I2C multiplexer channel selection and pull up resistor confusion 2019/04/10 06:45:09 (permalink)
+1 (1)
That chip is itself an I2C device, and those three address pins control which address it responds to, they do NOT select which slave is active.
You write to its control register to select which slave device is connected to the Master I2C bus.
The datasheet is at http://www.ti.com/lit/ds/symlink/tca9546a.pdf
 
#2
mbrowning
Just a Member
  • Total Posts : 1315
  • Reward points : 0
  • Joined: 2005/03/16 14:32:56
  • Location: Melbourne, FL
  • Status: offline
Re: I2C multiplexer channel selection and pull up resistor confusion 2019/04/10 06:51:21 (permalink) ☼ Best Answerby GunkutA 2019/04/10 06:56:47
0
20K is higher than I would normally use on I2C/SMBus by design. I've seen 10K used, but have also seen problems with it that were solved with lower values.
 
The datasheet is very clear on the function of A0-2. Have you read the pin function table?

Oh well - there's always next year
#3
GunkutA
Junior Member
  • Total Posts : 107
  • Reward points : 0
  • Joined: 2019/01/10 00:09:38
  • Location: 0
  • Status: online
Re: I2C multiplexer channel selection and pull up resistor confusion 2019/04/10 06:55:40 (permalink)
0
Okay so I need to communicate 3 of these batteries but this will not be simultaneously and timing is not a concern. In this case can I follow a protocol like the following : 
 
Send 0x01 to I2C multiplexer (For selecting first channel. ) -> Send address of the battery (0x16) -> Send command code ( for asking SOC) -> After receiving the data read it.
 
It does not sound correct probably I understood it wrong. For example, I2C multiplexer's address is not mentioned in datasheet. So will I write this 0x01 to an address buffer or to the transmit data buffer?
 
#4
GunkutA
Junior Member
  • Total Posts : 107
  • Reward points : 0
  • Joined: 2019/01/10 00:09:38
  • Location: 0
  • Status: online
Re: I2C multiplexer channel selection and pull up resistor confusion 2019/04/10 06:57:33 (permalink)
0
In PIN function table it says direct A0 & A1 directly to the ground or Vcc. Then how will I choose the channel. Ah okay so A pins are for selecting address of the MUX chip. I will directly connect them to ground and I will use B0 B1 .. in order to select channel so
 
post edited by GunkutA - 2019/04/10 07:00:30
#5
mbrowning
Just a Member
  • Total Posts : 1315
  • Reward points : 0
  • Joined: 2005/03/16 14:32:56
  • Location: Melbourne, FL
  • Status: offline
Re: I2C multiplexer channel selection and pull up resistor confusion 2019/04/10 06:59:24 (permalink)
+1 (1)
GunkutA
I2C multiplexer's address is not mentioned in datasheet.

I think you need to read more, type less.
 
See section 9.6.1

Oh well - there's always next year
#6
GunkutA
Junior Member
  • Total Posts : 107
  • Reward points : 0
  • Joined: 2019/01/10 00:09:38
  • Location: 0
  • Status: online
Re: I2C multiplexer channel selection and pull up resistor confusion 2019/04/10 07:11:49 (permalink)
0
Following a start condition, the bus master must output the address of the slave it is accessing.
In the figure 13 it can be seen that last 4 bits are fixed. With remaining 3 bits how can I send my slave address which is 0x16? 
#7
GunkutA
Junior Member
  • Total Posts : 107
  • Reward points : 0
  • Joined: 2019/01/10 00:09:38
  • Location: 0
  • Status: online
Re: I2C multiplexer channel selection and pull up resistor confusion 2019/04/10 07:46:58 (permalink)
0
Okay so I think it is: 
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. In this case I will ground A0 A1 and A2 pins. So:
 
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.
#8
Jump to:
© 2019 APG vNext Commercial Version 4.5