cancel
Showing results for 
Search instead for 
Did you mean: 

Multiplexing I2C on STM32f4 Board

yasinbjk50
Associate III

Hi all

I am using 4 sensors on my project. These are comminicated with stm32f4 board via I2C. However there ara 3 I2C channel on stm32f4 board. Is it possible to connect them to same channel via  ı2c multiplexer ? As ı researched, the multiplexer is used with the same sensors. The multiplexer i mentionoed is TCA9548A. 

10 REPLIES 10
Andrew Neil
Evangelist III

@yasinbjk50 wrote:

stm32f4 board  


Which STM32F4 board - an ST board, or your own custom board?

Fundamental to the operation of I2C is the Slave Address - that's what lets you have multiple Slaves on a single I2C bus.

Do your sensors not allow you to select different addresses?

 


@yasinbjk50 wrote:

The multiplexer i mentionoed is TCA9548A. 


So this:

https://www.ti.com/product/TCA9548A

Yes, as its datasheet shows, that is designed to allow a single I2C Master to connect to multiple I2C buses:

AndrewNeil_0-1710182671908.png

AndrewNeil_1-1710182785098.png

 

AScha.3
Chief II

Hi,

yes. see:

https://wolles-elektronikkiste.de/en/tca9548a-i2c-multiplexer

 

If you feel a post has answered your question, please click "Accept as Solution".
Karl Yamashita
Lead II

What sensor are you interfacing to? Most I2C devices can be hardwired for a different address. Then in FW, you can read/write to each sensor address independently. Knowing what sensor would clarify this.

I Can't Believe It's Not Butter. If you find my answers useful, click the accept button so that way others can see the solution.

The board ı am using is 32f407vg. However the sensors are different from each other (rtc module, pulse sensor, lux sensor, lcd module). As ı understand, TCA9548A is used for connecting same sensors. Is it appropriate device for my project?

DS1307 (RTC module), BH1705(Light Sensor), MAX30100 (Pulse Sensor), LCD Sensor. So these are much more than ı have I2C on STM32f407vg


@yasinbjk50 wrote:

The board ı am using is 32f407vg. 


That's not a board - that's just a chip.

Is that STM32F407VG chip mounted on an ST board, or a 3rd-party board, or your own custom board?

 


@yasinbjk50 wrote:

However the sensors are different from each other (rtc module, pulse sensor, lux sensor, lcd module)


Then they should all have different I2C Slave Addresses - yes?

 


@yasinbjk50 wrote:

As ı understand, TCA9548A is used for connecting same sensors


Generally, yes - or, at least, devices which all have the same I2C Slave Address.

 


@yasinbjk50 wrote:

 Is it appropriate device for my project?


Probably not: all your sensors should have different I2C Slave Addresses - so you shouldn't need a multiplexer for that.

Unless you have some other specific reason for it?

 


@yasinbjk50 wrote:

DS1307 (RTC module), BH1705(Light Sensor), MAX30100 (Pulse Sensor), LCD Sensor. So these are much more than ı have I2C on STM32f407vg


The datasheets for all these devices will tell you what I2C Slave Address(es) each one has.
(often devices have a choice of 2 or more addresses to minimise the risk of "collisions")

What is an "LCD Sensor"?
LCDs are usually output devices - so not "sensors" ...

 


@yasinbjk50 wrote:

 So these are much more than ı have I2C on STM32f407vg


Pardon?

The whole point of a bus is that it can be shared by multiple devices - I2C is a bus.

You can connect multiple devices to an I2C bus - it is the Slave Address which distinguishes them.

Example from Wikipedia:

AndrewNeil_0-1710327488882.png

 

Perhaps you need to read-up on the I2C bus:

https://en.wikipedia.org/wiki/I%C2%B2C

UM10204 2C-bus specification and user manual - this is the definitive specification of the  I2C bus:

https://www.nxp.com/docs/en/user-guide/UM10204.pdf

There are many 3rd-party tutorials; eg,

https://learn.sparkfun.com/tutorials/i2c/all

https://www.i2c-bus.org/

And they all have same address ?????

Come on, this is I2C bus , can have > 100 chips on one bus . Just each has to have its own address.

If you feel a post has answered your question, please click "Accept as Solution".

The sensors have different addresses. I will read you shared. İt is good to know that I2C can have > 100 chips on one.

I will notice that thx.