Page 1 of 2

Does the Esp32 support hardware based I2C or software bit-bang based I2C ?

Posted: Mon Sep 12, 2016 8:16 am
by santhoshESp32
In hardware specification its given that there are 2 hardware I2C and even in memory map its given like i2c0 and i2c1, but in SoC i have not seen any dedicated pin. and in SDK example also no clues about I2C .please clarify this issue.

Re: Does the Esp32 support hardware based I2C or software bit-bang based I2C ?

Posted: Mon Sep 12, 2016 10:21 am
by ESP_Sprite
Yes, the digital portion has two hardware I2C modules. You don't see the pins for it in the pinout because they're conencted to the GPIO mux and you can connect them to any of the (output-capable) GPIOs.

Re: Does the Esp32 support hardware based I2C or software bit-bang based I2C ?

Posted: Mon Nov 21, 2016 10:41 am
by Ritesh
Hi,

I am working on ESP32 chip and have one requirement to connect temperature sensor over I2C Interface. I have also checked into ESP32 Data-sheet and found that there are 2 dedicated I2C interface which can be used for sensor based products.

I have checked ESP32 pin configurations and not found any dedicated pin like I2C or SDA or SCL line for I2C Interface but I have checked technical reference document and found that it is padding with Touch Sensor but not found exact pin number for that and how to use that pin with configurations.
RTCIO_SAR_I2C_SDA_SEL Selects a different pad as the RTC I2C SDA signal. 0: use pad
TOUCH_PAD[1]; 1: use pad TOUCH_PAD[3]. (R/W)
RTCIO_SAR_I2C_SCL_SEL Selects a different pad as the RTC I2C SCL signal. 0: use pad
TOUCH_PAD[1]; 1: use pad TOUCH_PAD[3]. (R/W)
Please help me to select I2C Pin for ESP32 based chip and how to configure it if it is interfaced with Touch Sensor and RTC.

Re: Does the Esp32 support hardware based I2C or software bit-bang based I2C ?

Posted: Mon Nov 21, 2016 5:20 pm
by Ritesh
Hi,

Does anyone has any information for previous question which I have asked?

Re: Does the Esp32 support hardware based I2C or software bit-bang based I2C ?

Posted: Mon Nov 21, 2016 8:36 pm
by kolban
There is a great post on the roadmap of the ESP32 that can be found here:

http://esp32.com/viewtopic.php?f=10&t=375

What you will find is that the current drivers for the ESP-IDF framework are far from complete. The plan by Espressif is to try and make those available by the 1st of December which is only a couple of weeks away. Included in the list of things still to be done by that date are I2C drivers. When the drivers are available, at that time we will be able to start building good samples. In the interim, you might want to look at the ESP32 Arduino project. This claims support for I2C on ESP32 today.

Re: Does the Esp32 support hardware based I2C or software bit-bang based I2C ?

Posted: Mon Nov 21, 2016 10:39 pm
by martinayotte
1st of December which is only a couple of weeks away
You probably means "couple of days" ... ;)

Re: Does the Esp32 support hardware based I2C or software bit-bang based I2C ?

Posted: Tue Nov 22, 2016 1:29 am
by Ritesh
kolban wrote:There is a great post on the roadmap of the ESP32 that can be found here:

http://esp32.com/viewtopic.php?f=10&t=375

What you will find is that the current drivers for the ESP-IDF framework are far from complete. The plan by Espressif is to try and make those available by the 1st of December which is only a couple of weeks away. Included in the list of things still to be done by that date are I2C drivers. When the drivers are available, at that time we will be able to start building good samples. In the interim, you might want to look at the ESP32 Arduino project. This claims support for I2C on ESP32 today.
Hi,

Thanks for Reply.

So, Are you sure that Espressif will release ESP32-IDF on 1st December with all features mentioned in release note?

If yes then it will be good for us but till that time we need to wait for that as we require it as quickly as possible.

Also, I have asked one more question regarding pin connection for I2C0 SDA and SCL line for ESP32 chip. I have checked data sheet of ESP32 but not found exact location of pin where I need to connect I2C based lines. I just found that those are shared with RTC and Touch Sensors.

Please help me on this as well if anyone has more idea about this.

Re: Does the Esp32 support hardware based I2C or software bit-bang based I2C ?

Posted: Tue Nov 22, 2016 1:48 am
by WiFive
Did you read about gpio matrix? Means signals can be on (almost) ANY free pin.

Re: Does the Esp32 support hardware based I2C or software bit-bang based I2C ?

Posted: Tue Nov 22, 2016 1:54 am
by ESP_igrr
Probably not *all* the features, but most of them.

Regarding I2C: it is mentioned in the technical reference manual that I2C peripheral is connected to the GPIO mux. So you can route sda and scl pins to any GPIO (which can be output and which is in the correct power domain). Please check the technical reference manual...

For code samples, don't forget to check arduino-esp32 project, in particular various "hal" files. I2C implantation is among them.

Re: Does the Esp32 support hardware based I2C or software bit-bang based I2C ?

Posted: Tue Nov 22, 2016 3:54 am
by Ritesh
Hi,

Thanks for Reply.

But, I have checked esp32-hal-i2c.c file and found following 2 macros defined which is mapped directly with GPIO mux.
#define I2C_SCL_IDX(p) ((p==0)?I2CEXT0_SCL_OUT_IDX:((p==1)?I2CEXT1_SCL_OUT_IDX:0))
#define I2C_SDA_IDX(p) ((p==0)?I2CEXT0_SDA_OUT_IDX:((p==1)?I2CEXT1_SDA_OUT_IDX:0))
So, I have one doubt that here we just need to select that either we can use I2C0 or I2C1 as per argument provided as input parameter. There is no any specific GPIO we need to define for SDA and SCL Line.

So, on which IO I need to connect SDA and SCL pin if there is plan to use either I2C0 or I2C1?

Please let me know your feedback or reply if you have any idea for this ASAP.