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

santhoshESp32
Posts: 1
Joined: Mon Sep 12, 2016 7:57 am

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

Postby santhoshESp32 » Mon Sep 12, 2016 8:16 am

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.

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

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

Postby ESP_Sprite » Mon Sep 12, 2016 10:21 am

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.

Ritesh
Posts: 1365
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

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

Postby Ritesh » Mon Nov 21, 2016 10:41 am

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.
Regards,
Ritesh Prajapati

Ritesh
Posts: 1365
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

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

Postby Ritesh » Mon Nov 21, 2016 5:20 pm

Hi,

Does anyone has any information for previous question which I have asked?
Regards,
Ritesh Prajapati

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

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

Postby kolban » Mon Nov 21, 2016 8:36 pm

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.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

User avatar
martinayotte
Posts: 141
Joined: Fri Nov 13, 2015 4:27 pm

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

Postby martinayotte » Mon Nov 21, 2016 10:39 pm

1st of December which is only a couple of weeks away
You probably means "couple of days" ... ;)

Ritesh
Posts: 1365
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

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

Postby Ritesh » Tue Nov 22, 2016 1:29 am

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.
Regards,
Ritesh Prajapati

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

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

Postby WiFive » Tue Nov 22, 2016 1:48 am

Did you read about gpio matrix? Means signals can be on (almost) ANY free pin.

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

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

Postby ESP_igrr » Tue Nov 22, 2016 1:54 am

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.

Ritesh
Posts: 1365
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

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

Postby Ritesh » Tue Nov 22, 2016 3:54 am

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.
Regards,
Ritesh Prajapati

Who is online

Users browsing this forum: Majestic-12 [Bot], Vineethad and 150 guests