Default I2C pins on ESP32-3C

Basirk
Posts: 3
Joined: Tue Aug 10, 2021 11:23 am

Default I2C pins on ESP32-3C

Postby Basirk » Tue Aug 10, 2021 11:46 am

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 :/

ESP_Minatel
Posts: 364
Joined: Mon Jan 04, 2021 2:06 pm

Re: Default I2C pins on ESP32-3C

Postby ESP_Minatel » Tue Aug 10, 2021 12:01 pm

Hi,

You can use any pin for I2C.

See this on our Arduino support documentation.

IO Mux

Basirk
Posts: 3
Joined: Tue Aug 10, 2021 11:23 am

Re: Default I2C pins on ESP32-3C

Postby Basirk » Tue Aug 10, 2021 1:01 pm

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?

ESP_Minatel
Posts: 364
Joined: Mon Jan 04, 2021 2:06 pm

Re: Default I2C pins on ESP32-3C

Postby ESP_Minatel » Tue Aug 10, 2021 4:10 pm

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

Basirk
Posts: 3
Joined: Tue Aug 10, 2021 11:23 am

Re: Default I2C pins on ESP32-3C

Postby Basirk » Tue Aug 10, 2021 4:18 pm

Yup, that makes sense.
Thanks for taking the time to reply so fully - I appreciate it.

stratom
Posts: 3
Joined: Wed Aug 18, 2021 12:05 pm

Re: Default I2C pins on ESP32-3C

Postby stratom » Tue Aug 24, 2021 11:40 pm

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!

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

Re: Default I2C pins on ESP32-3C

Postby ESP_Sprite » Wed Aug 25, 2021 1:52 am

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.

bstolk
Posts: 23
Joined: Fri Jan 07, 2022 6:44 am

Re: Default I2C pins on ESP32-3C

Postby bstolk » Sat Jan 15, 2022 12:43 am

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?

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

Re: Default I2C pins on ESP32-3C

Postby ESP_Sprite » Sat Jan 15, 2022 3:43 am

You should be able to simply reflash it; does that not work?

bstolk
Posts: 23
Joined: Fri Jan 07, 2022 6:44 am

Re: Default I2C pins on ESP32-3C

Postby bstolk » Sat Jan 15, 2022 3:59 am

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?

Who is online

Users browsing this forum: Google [Bot] and 32 guests