I2C Pins.

romba89
Posts: 7
Joined: Thu Mar 02, 2017 12:12 pm

I2C Pins.

Postby romba89 » Wed Mar 15, 2017 12:17 pm

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.

preetam
Posts: 49
Joined: Thu Jan 26, 2017 2:31 pm
Location: Germany

Re: I2C Pins.

Postby preetam » Wed Mar 15, 2017 12:39 pm

I think 21,22 work with arduino.

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

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: I2C Pins.

Postby ESP_igrr » Wed Mar 15, 2017 2:03 pm

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.

romba89
Posts: 7
Joined: Thu Mar 02, 2017 12:12 pm

Re: I2C Pins.

Postby romba89 » Thu Mar 16, 2017 5:10 am

ESP_igr,

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

Thanks again.

satish
Posts: 2
Joined: Mon Jul 10, 2017 9:25 am

Re: I2C Pins.

Postby satish » Mon Nov 06, 2017 4:05 pm

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.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: I2C Pins.

Postby WiFive » Tue Nov 07, 2017 12:03 am

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

satish
Posts: 2
Joined: Mon Jul 10, 2017 9:25 am

Re: I2C Pins.

Postby satish » Tue Nov 07, 2017 2:26 pm

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 ) .

BRUNOFJJR
Posts: 1
Joined: Tue Jul 24, 2018 5:31 pm

Re: I2C Pins.

Postby BRUNOFJJR » Tue Jul 24, 2018 5:38 pm

I2C_SDA - MTDO - GPIO15
I2C_SCL - GPIO2
I2C_SDA - GPIO0
I2C_SCL - GPIO4

ESP_Sprite
Posts: 9757
Joined: Thu Nov 26, 2015 4:08 am

Re: I2C Pins.

Postby ESP_Sprite » Wed Jul 25, 2018 2:40 am

@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.

Who is online

Users browsing this forum: cdollar, Google [Bot], MicroController and 183 guests