Cannot reconfigure certain pins for GPIO usage

mrdakwar
Posts: 2
Joined: Sat Jan 14, 2023 6:11 pm

Cannot reconfigure certain pins for GPIO usage

Postby mrdakwar » Wed Mar 29, 2023 3:00 pm

I have been using both the ESP32-C3 Devkit and a custom board using the ESP32-C3FN4 (which has the SPI pins attached)

I am attempting to use pins 19-24 (GPIO 12-17) as simply GPIO. Whenever I run my code to reconfigure the pins as GPIO, I get a looped boot with the serial output shown below. What baffles me is that I ran this same code but on pins 25-26 (GPIO 18,19 the USB pins) and it works without issue.

All the code is as simple as shown below. What is to be noted is that GPIO is not the default function for GPIO 12-17 (and others). Which means I need to change the function, but this is not clearly communicated how to do so. Even when I run Espressif's code, it throws the same error. For example, the Blink example they provide crashes when you set the pin to 12-17, so they are not checking to configure it in their own code.

Arduino Code

Code: Select all

#define GPIO_GATE 14
void setup() {
  // No need to initialize the RGB LED
}
void loop() {
  pinMode(GPIO_GATE,OUTPUT);
  digitalWrite(GPIO_GATE,HIGH);
  delay(3000);
  digitalWrite(GPIO_GATE,LOW);
  delay(3000);
}
Serial Output

Code: Select all

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x8 (TG1WDT_SYS_RST),boot:0xd (SPI_FAST_FLASH_BOOT)
Saved PC:0x40380080
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd5810,len:0x438
load:0x403cc710,len:0x918
load:0x403ce710,len:0x24e4
entry 0x403cc710

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

Re: Cannot reconfigure certain pins for GPIO usage

Postby ESP_Sprite » Thu Mar 30, 2023 6:51 am

Those pins are where the flash from where your program is executed, is connected. Using them for anything else is not supported (datasheet: "These pins are not recommended for other uses."), and trying to reconfigure them leads to crashes, as you found out.

mrdakwar
Posts: 2
Joined: Sat Jan 14, 2023 6:11 pm

Re: Cannot reconfigure certain pins for GPIO usage

Postby mrdakwar » Thu Mar 30, 2023 4:39 pm

I see, an oversight I made. Since I am using it in DIO mode with internal flash, it does free up GPIO 12 & 13, but the other 4 I cannot use.

Who is online

Users browsing this forum: gfvalvo and 66 guests