Page 1 of 1

Crash when configure GPIO9

Posted: Thu Mar 16, 2017 1:42 am
by taxi_dong
Hello
I am debugging ESP32 with voice control feature. GPIO9 is designed to control the reset pin of the sensor.
Code:
=================================================
#define RESET_GPIO 9
gpio_config_t io_conf;

io_conf.intr_type = GPIO_PIN_INTR_DISABLE;
io_conf.mode = GPIO_MODE_OUTPUT;
io_conf.pin_bit_mask = 1 << RESET_GPIO;
io_conf.pull_down_en = 0;
io_conf.pull_up_en = 1;
gpio_config(&io_conf);

Log print:
===================================================================================
[0;32mI (1102) gpio: GPIO[9]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 [0m
[0;32mI (1112) gpio: PIN_FUNC_SELECT +[0m
Guru Meditation Error of type IllegalInstruction occurred on core 0. Exception was unhandled.
Register dump:
PC : 0x400e6274 PS : 0x00060c30 A0 : 0x800e5fbe A1 : 0x3ffb9ec0
A2 : 0x3ffb5310 A3 : 0x3ffb4210 A4 : 0x3f40466c A5 : 0x0000001f
A6 : 0x00000001 A7 : 0x00000005 A8 : 0x800e632c A9 : 0x3ffb9e80
A10 : 0x00000000 A11 : 0x3ffb4210 A12 : 0x3f404f50 A13 : 0x0000001f
A14 : 0x00000001 A15 : 0x00000005 SAR : 0x00000004 EXCCAUSE: 0x00000000
EXCVADDR: 0x00000000 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xfffffffb

Backtrace: 0x400e6274:0x3ffb9ec0 0x400e5fbe:0x3ffb9ee0
====================================================================================
I add log print, find it is crash at PIN_FUNC_SELECT function.

esp_err_t gpio_config(gpio_config_t *pGPIOConfig)
{
......

ESP_LOGI(GPIO_TAG, "PIN_FUNC_SELECT +");
PIN_FUNC_SELECT(io_reg, PIN_FUNC_GPIO); /*function number 2 is GPIO_FUNC for each pin */
ESP_LOGI(GPIO_TAG, "PIN_FUNC_SELECT -");
}

Then i try to swtich GPIO9 to GPIO 27, it is fine, no crash, can measure the wave by the scope whn driver pin 27 high and low

I copy follow info from esp32_chip_pin_list_cn.pdf
Function1--- Type-----Function2---Type----Function3----Type-----Function4-----Type
GPIO27------ -I/O/T--------------------------------GPIO27--------I/O/T
SD_DATA2----I1/O/T--SPIHD--------I/O/T-----GPIO9---------I/O/T----HS1_DATA2---I1/O/T

Thanks for any idea you share!

Re: Crash when configure GPIO9

Posted: Thu Mar 16, 2017 2:40 am
by ESP_Angus
In common configurations (including ESP-WROOM32), GPIO9 is connected to the external SPI flash of the ESP32. So it can't easily be used as a general purpose I/O pin.

GPIOs 6, 7, 8, 9, 10, 11 are used this way on ESP-WROOM32.

I thought this was mentioned in the ESP-WROOM32 datasheet, but it seems to be overlooked. I'll request that the documentation team update the document.

Re: Crash when configure GPIO9

Posted: Thu Mar 16, 2017 3:01 am
by taxi_dong
Thanks for quick reply. I do use ESPWROOM32 module now

Re: Crash when configure GPIO9

Posted: Thu Mar 16, 2017 5:36 am
by taxi_dong
Update:
I found follow info in web site. But not sure esp32 pdf include these info
=========================================================================================
http://esp-idf.readthedocs.io/en/latest ... /gpio.html

GPIO & RTC GPIO
Overview
The ESP32 chip features 40 physical GPIO pads. Some GPIO pads cannot be used or do not have the corresponding pin on the chip package(refer to technical reference manual ). Each pad can be used as a general purpose I/O or can be connected to an internal peripheral signal.
Note that GPIO6-11 are usually used for SPI flash.
GPIO34-39 can only be set as input mode and do not have software pullup or pulldown functions.
=========================================================================================

Re: Crash when configure GPIO9

Posted: Tue Dec 12, 2017 5:55 pm
by specialvict
ESP_Angus wrote:In common configurations (including ESP-WROOM32), GPIO9 is connected to the external SPI flash of the ESP32. So it can't easily be used as a general purpose I/O pin.

GPIOs 6, 7, 8, 9, 10, 11 are used this way on ESP-WROOM32.

I thought this was mentioned in the ESP-WROOM32 datasheet, but it seems to be overlooked. I'll request that the documentation team update the document.
Dear Angus,

I'm trying to use `SDMMC_HOST_SLOT_0` on ESP-WROOM32, which using IO6-11 configure like this:

Code: Select all

PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CLK_U, FUNC_SD_CLK_HS1_CLK);
	PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA0_U, FUNC_SD_DATA0_HS1_DATA0);
	PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA1_U, FUNC_SD_DATA1_HS1_DATA1);
	PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA2_U, FUNC_SD_DATA2_HS1_DATA2);
	PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA3_U, FUNC_SD_DATA3_HS1_DATA3);
	PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CMD_U, FUNC_SD_CMD_HS1_CMD);
But I also crashed when I configure the IO9, is that mean that I should not use `SDMMC_HOST_SLOT_0` on ESP-WROOM32?

Best Regards,

Victor

Re: Crash when configure GPIO9

Posted: Thu Dec 14, 2017 11:12 am
by ESP_Sprite
Yes, that slot is incompatible with the ESP32 being used with SPI flash on these GPIOs.

Re: Crash when configure GPIO9

Posted: Tue Feb 04, 2020 11:09 am
by arunmishra
Hi,

I have configured these GPIO9 and GPIO10 as an UART1. These things were working initially on ESP32-WROVER module. Then I have configured WIFI with LWIP library. Even after this configuration these pins worked for sometimes. Now I am starting to get crash on any serial data on these pins. I am wondering what could have gone wrong which is making this crash ?

Thanks

Re: Crash when configure GPIO9

Posted: Tue Feb 04, 2020 11:33 am
by ESP_krzychb
Hi arunmishra, please check https://randomnerdtutorials.com/esp32-p ... nce-gpios/, especially "Notes" column in the table that lists all the pins, against GPIO9 and 10 that you like to use.