SoftI2C with two same devices

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
Jurkylius
Posts: 7
Joined: Fri Oct 02, 2020 11:46 am

SoftI2C with two same devices

Post by Jurkylius » Thu Sep 02, 2021 11:04 am

Hello,
I need advice. Using ESP32 DevKit and on standard I2C pins have connected DS3231 and 2x SHT20 sensor. Because SHT20 have same address I try create another I2C connection in other GPIO(test 0/4 and 32/33 gpio) but still have 119 EROR. When I try scan method on this give me [] result. One SHT connected to standard I2C working well.
Is any option for create working structure of this sensors without TCA9548?
Many thanks.

elschopi
Posts: 16
Joined: Tue May 12, 2020 5:12 am
Location: Bavaria, Germany

Re: SoftI2C with two same devices

Post by elschopi » Fri Sep 03, 2021 9:07 am

Hi,

I'm using an ESP32 and it's two I2C without a problem. Maybe there's an error in your configuration?
Could you post how you instantiate the i2c devices?
On the ESP32 DevKit I'd try to use the hardware I2C bus.
Here's the official documentation on SoftI2C: https://docs.micropython.org/en/latest/ ... re-i2c-bus
(there's also the documentation for hardware I2C if you scroll around a little)
Also note that there are some pins you shouldn't use: https://docs.micropython.org/en/latest/ ... rd-control
Regarding pin numbers: I'd think you should try other pin numbers. See the link above.

best regards,
Chris


edit: Just realized you gave pin numbers, edited post accordingly.

Jurkylius
Posts: 7
Joined: Fri Oct 02, 2020 11:46 am

Re: SoftI2C with two same devices

Post by Jurkylius » Mon Sep 06, 2021 10:52 am

I update firmware to 1.16 and using this i2c declaration.

from machine import SoftI2C, Pin

Code: Select all

i2c = SoftI2C(sda=Pin(21), scl=Pin(22), freq=100000) // this i2c working good

i2co = SoftI2C(sda=Pin(32), scl=Pin(33), freq=100000) // not working, scan return [], write and read get 119 ERROR
or
i2co = SoftI2C(sda=Pin(0), scl=Pin(4), freq=100000) 

Post Reply