Crash when configure GPIO9
Posted: Thu Mar 16, 2017 1:42 am
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!
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!