Page 1 of 1

I2C Pins.

Posted: Wed Mar 15, 2017 12:17 pm
by romba89
According to the datasheets, ESP32 has two i2c interfaces.
And one set of pins corresponding is (21,22).

What's the other pin set that can be used for the second i2c interface? Are they also dedicated or any GPIO pin can be configure as I2C?

Cheers.

Re: I2C Pins.

Posted: Wed Mar 15, 2017 12:39 pm
by preetam
I think 21,22 work with arduino.

for esp-idf there is an example at https://github.com/espressif/esp-idf/tr ... herals/i2c

Re: I2C Pins.

Posted: Wed Mar 15, 2017 2:03 pm
by ESP_igrr
Both I2C interfaces are connected to pins via GPIO matrix, so you can select arbitrary IOs for SDA and SCL. Just observe the constraints of each pin, such is I/O capability, bootstrapping function, and so on. See "ESP32 Chip Pin List" document for details.

Re: I2C Pins.

Posted: Thu Mar 16, 2017 5:10 am
by romba89
ESP_igr,

Thanks for the lead, this is what i was trying to confirm.

Thanks again.

Re: I2C Pins.

Posted: Mon Nov 06, 2017 4:05 pm
by satish
Hi

Im using PIN34 (SDA )and 35 (SCL) for i2c interface. Getting following errors

E (723) i2c: C:/esp/esp-idf/components/driver/i2c.c:606 (i2c_set_pin):sda gpio number error
ESP_ERROR_CHECK failed: esp_err_t 0x102 at 0x400d1d70
file: "C:/esp/esp-idf/examples/esp_i2c/i2c_scanner/main/main.c" line 36
func: app_main
expression: i2c_param_config(I2C_NUM_0, &conf)

Backtrace: 0x40086c44:0x3ffb40d0 0x40086fa9:0x3ffb40f0 0x400d1d70:0x3ffb4110 0x400d086f:0x3ffb4160

When i changed the pins to other I/O it works fine. Is there any limitation in using pins 34-39 for i2c as manual says any GPIO.

Pl help me.

Re: I2C Pins.

Posted: Tue Nov 07, 2017 12:03 am
by WiFive
ESP_igrr wrote:Both I2C interfaces are connected to pins via GPIO matrix, so you can select arbitrary IOs for SDA and SCL. Just observe the constraints of each pin, such as I/O capability, bootstrapping function, and so on. See "ESP32 Chip Pin List" document for details.
34-39 input only

Re: I2C Pins.

Posted: Tue Nov 07, 2017 2:26 pm
by satish
Hi

Now due to the constrain on pin 34-39 as input only i have changed my interface to pin 18 (SCL) and 19 (SDA) and running i2cscanner program to get the device address. I have 24CXX device breakout board and trying to get address printed , am using ESP32 DevKitC and esp-idf. The program run for complete iteration(0-127) but no address is displayed. Then tried with different pins like 21,22 ; 16,17 but no luck at all. What am i missing. the code which im running is in below link

https://github.com/nkolban/esp32-snippe ... 2c/scanner

Kindly help me out as i have to use this understanding to interface with IO expander ( Any suggestion on io expander with esp-idf will be good start ) .

Re: I2C Pins.

Posted: Tue Jul 24, 2018 5:38 pm
by BRUNOFJJR
I2C_SDA - MTDO - GPIO15
I2C_SCL - GPIO2
I2C_SDA - GPIO0
I2C_SCL - GPIO4

Re: I2C Pins.

Posted: Wed Jul 25, 2018 2:40 am
by ESP_Sprite
@satish: Do you have external pull-ups for those I2C pins? If so, can you connect a logical analyzer or oscilloscope to these pins and see what signals are there? FWIW: Both 21/22 and 16/17 should work fine on a DevkitC.