Page 1 of 2

Default I2C pins on ESP32-3C

Posted: Tue Aug 10, 2021 11:46 am
by Basirk
Hi. This is my first post here. Be gentle.

I've been experimenting with AiThinker ESP32-3CF and 3CU modules. The datasheets for these both show the flash download strapping pins being GPIO8 and 9.

Now, here's the pins.h file for the ESP32-C3 variant:
https://github.com/espressif/arduino-es ... _arduino.h
This specifies the I2C SDA and SCL pins also as GPIO8 and 9. I get that you're not going to be doing any I2C during flashing, but still, is this wise? There's going to be other hardware wired to those pins. Would it be better to use something like GPIO18 and 19?

Apologies if this has been discussed before. I did try searching the forum but the search didn't work :/

Re: Default I2C pins on ESP32-3C

Posted: Tue Aug 10, 2021 12:01 pm
by ESP_Minatel
Hi,

You can use any pin for I2C.

See this on our Arduino support documentation.

IO Mux

Re: Default I2C pins on ESP32-3C

Posted: Tue Aug 10, 2021 1:01 pm
by Basirk
Thanks for replying. Are you saying that GPIO8 and 9 are fine to use with I2C, or that I can easily change which pins I use, or both?
If it's the former, I think you're right - but I've not tested it. I have already used different pins in my project to avoid any issues.
If it's the latter (as using 8 and 9 might cause problems if you also have I2C devices connected), then specifying different pins as the default in the pins.h file would make more sense, wouldn't it?

Re: Default I2C pins on ESP32-3C

Posted: Tue Aug 10, 2021 4:10 pm
by ESP_Minatel
If you take a look at the datasheet, you'll see the strapping pins table (see image):
Screenshot from 2021-08-10 17-05-30.png
Screenshot from 2021-08-10 17-05-30.png (59.61 KiB) Viewed 31969 times
This means that both GPIO's 8 and 9 can be used for I2C, since you'll have the pullups required by the I2C. The best to do is to test this on your board and see the results. Probably this gonna work.

The GPIO8 will not make any difference by adding the pullup resistor if you haven't changed the eFuse configuration.

Re: Default I2C pins on ESP32-3C

Posted: Tue Aug 10, 2021 4:18 pm
by Basirk
Yup, that makes sense.
Thanks for taking the time to reply so fully - I appreciate it.

Re: Default I2C pins on ESP32-3C

Posted: Tue Aug 24, 2021 11:40 pm
by stratom
Can I add an additional question regarding the strapping PINs?
The technical reference manual(ch 7.2) states IO2 should pulled high for SPI-Boot as well as Download-Boot.
However I couldn't find any information what happens if the Bit is not read "1"?
Furthermore, the DevKitM-1 does not pull this pin up or down, but routes it to the header.
Therefore I'd really like to know for what I can use IO2 for. And if it must not be read low, if i can disable this behavior using e-fuses?

Thanks!

Re: Default I2C pins on ESP32-3C

Posted: Wed Aug 25, 2021 1:52 am
by ESP_Sprite
I don't have the documentation here, but from memory it boots up in a mode that is used for chip testing in the factory. You can still use this pin; you simply must make sure that the chip reads a high level on bootup/reset. As soon as the chip is running, you can use it as any other GPIO.

Re: Default I2C pins on ESP32-3C

Posted: Sat Jan 15, 2022 12:43 am
by bstolk
I think GPIO 8/9 for I2C is indeed dangerous.

I tried scanning the I2C bus with a OLED attached, and I am now left with a corrupted board, that spews this in a never ending stream:

Code: Select all

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x420
load:0x403ce000,len:0x90c
load:0x403d0000,len:0x236c
SHA-256 comparison failed:
Calculated: ccb0d00bac7e84e1d90a12e4f75f4ab6c5f7e71bb209afd5819c4c9557a6db71
Expected: c9cf160580940ec7801c73b16423824e72ad12055c732e83ce66332240af42a7
Attempting to boot anyway...
entry 0x403ce000
Can the device be revived, or do I need to throw it out?

Re: Default I2C pins on ESP32-3C

Posted: Sat Jan 15, 2022 3:43 am
by ESP_Sprite
You should be able to simply reflash it; does that not work?

Re: Default I2C pins on ESP32-3C

Posted: Sat Jan 15, 2022 3:59 am
by bstolk
ESP_Sprite wrote:
Sat Jan 15, 2022 3:43 am
You should be able to simply reflash it; does that not work?
Reflash, as in reprogram?

When I build and upload a new program, I get the same issue. I use arduino ide.

Can I reflash the bootloader, maybe? If so, how?