synchronisation i2c esp32 (esp-idf)

mohasrj
Posts: 33
Joined: Mon Jan 20, 2020 9:38 am

synchronisation i2c esp32 (esp-idf)

Postby mohasrj » Wed Jun 17, 2020 8:24 am

hi everyone,

I want to connect until 8 device i2c to my esp32 (the same or different device like i can connect 8 bme280 or
-2 bme280
-2 BH1750
-2 expender mcp2307
-2 ADC3428 .... )

i dont know what is the best method to do that, i try to use mux TCA9548A but i dont know how i can do synchronisation between all task

and i find in github library i2cdev https://github.com/UncleRus/esp-idf-lib but i dont understand well how it work (install driver for each device ... ) so i cant add other device.

i dont know in my case what is better use i2cdev or directly write simple program to read each i2c slaves one by one and how i can do synchronisation between all device task ???

i2cdev : https://github.com/UncleRus/esp-idf-lib

normal i2c : https://www.lucadentella.it/en/2017/10/ ... i2c-basic/

i2c_self_test https://github.com/espressif/esp-idf/bl ... ple_main.c


best regard,

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

Re: synchronisation i2c esp32 (esp-idf)

Postby PeterR » Wed Jun 17, 2020 11:11 pm

Usually you do not need an I2C mux. Instead you use pull ups on the actual devices to give each an address. You may then use a single I2C channel to talk to each device on its (pull up) address.
I have not checked if you have address conflicts with you're parts nor details on how the TCA9548A mux works.
Maybe you could just allocate 2 pins to another I2C channel? Seems a step around solution - if you have the pins. That or look for different devices. You have quite a few devices on one channel so maybe you will have unresovable address conflicts but typically then you would choice another device so as to avoid conflict & rather than add more silicon.
Publish your address options, what are the problem conflicts?
& I also believe that IDF CAN should be fixed.

Who is online

Users browsing this forum: Bing [Bot], kobylin and 102 guests