Description
Board
ESP32 Dev Module (ESP32-WROOM32U)
Device Description
Generic devkit
Hardware Configuration
Nothing is attached to the board
Version
v3.2.0
IDE Name
Arduino IDE 2.4.5
Operating System
Windows10
Flash frequency
80
PSRAM enabled
no
Upload speed
115200
Description
I wrote a simple sketch, using an Arduino framework, It just displays pin 16 state: reserved or not
Sketch outputs:
....
Pin 16 is not reserved
Pin 16 is not reserved
Pin 16 is not reserved
...
Next step is that I initialize UART2 on pins 16 and 17 (IO_MUX pins), by calling uartBegin():
......
[ 13259][V][esp32-hal-uart.c:552] uartBegin(): UART2 baud(115200) Mode(8000001c) rxPin(16) txPin(17)
[ 13269][V][esp32-hal-uart.c:650] uartBegin(): UART2 not installed. Starting installation
[ 13277][V][esp32-hal-uart.c:660] uartBegin(): UART2 RX FIFO full threshold set to 112 (value requested: 112 || FIFO Max = 128)
[ 13289][V][esp32-hal-uart.c:681] uartBegin(): Setting UART2 to use REF_TICK clock
[ 13298][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 16 successfully set to type UART_RX (2) with bus 0x3ffbdd18
[ 13309][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 17 successfully set to type UART_TX (3) with bus 0x3ffbdd18
[ 13320][V][esp32-hal-uart.c:732] uartBegin(): UART2 initialization done.
Sketch outputs:
....
Pin 16 is reserved
Pin 16 is reserved
Pin 16 is reserved
Pin 16 is reserved
....
Shutting down UART2 via uartEnd():
[ 19051][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 16 successfully set to type INIT (0) with bus 0x0
[ 19063][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 17 successfully set to type INIT (0) with bus 0x0
Sketch outputs:
Pin 16 is reserved
Pin 16 is reserved
Pin 16 is reserved
Pin 16 is reserved
If I keep creating/deleting UART2 on all available pins than they all eventuially get reserved.
The same behaviour when I create/delete I2C interfaces. In bot cases I use Arduino Core functions (i.e. uartBegin() and i2cInit())
Expected behaviour: GPIOs must be revoked after driver is deinitialized
Sketch
#include <Arduino.h>
#if __has_include("esp_private/esp_gpio_reserve.h")
# include "esp_private/esp_gpio_reserve.h"
#elif __has_include("esp_gpio_reserve.h")
# include "esp_gpio_reserve.h"
#else
# warning "esp_gpio_reserve.h is not found, lets see if it will compile at all"
#endif
void setup() {
Serial.begin(115200);
}
void loop() {
while(1) {
printf("Pin 16 is %sreserved\r\n",esp_gpio_is_reserved(1ULL << 16) ? "" : "not ");
delay(1500);
}
}
Debug Message
see above
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
- I confirm I have checked existing issues, online documentation and Troubleshooting guide.