Page 1 of 1

GPIO16/17 initialization issues

Posted: Wed Apr 19, 2017 7:10 am
by iosixllc
I'm getting a crash when I do the following:

#define SETGPIO(num) \
gpio_set_direction(num, GPIO##num##_MODE); \
if (GPIO##num##_MODE == GPIO_MODE_OUTPUT || GPIO##num##_MODE == GPIO_MODE_INPUT_OUTPUT_OD) \
gpio_set_level(num, GPIO##num##_LEVEL); \
gpio_set_pull_mode(num, GPIO##num##_PULL); \
if (GPIO##num##_PULL == GPIO_PULLUP_ONLY) \
gpio_pullup_en(num); \
if (GPIO##num##_PULL == GPIO_PULLDOWN_ONLY) \
gpio_pulldown_en(num); \
gpio_matrix_out(num, SIG_GPIO_OUT_IDX, 0, 0); \
gpio_pad_select_gpio(num);

#define GPIO16_MODE GPIO_MODE_OUTPUT
#define GPIO16_LEVEL 0
#define GPIO16_PULL GPIO_FLOATING
#define SetS1708sleep(on) gpio_set_level(16, on)

#define GPIO17_MODE GPIO_MODE_OUTPUT
#define GPIO17_LEVEL 1
#define GPIO17_PULL GPIO_FLOATING
#define SetSPI_CS_ACC(on) gpio_set_level(17, !(on))

SETGPIO(16);
or
SETGPIO(17);

Any ideas? Thanks!

Re: GPIO16/17 initialization issues

Posted: Wed Apr 19, 2017 8:27 am
by ESP_igrr
Based on your messages in the other topics, any chance you got one of these ESP32-D2WD samples and running the code on those? If so, GPIO16 and 17 are used for the embedded flash, so reconfiguring them as GPIOs is a reliable way to cause a crash.

Also, possibly this issue is an answer to your other question:
https://esp32.com/viewtopic.php?f=12&t= ... 7892#p7892

Re: GPIO16/17 initialization issues

Posted: Thu Apr 20, 2017 6:46 pm
by iosixllc
Ok, because 16 &17 aren't used by the D0WD for flash communication. Are any of the VDIO power domain pins available as GPIOs on D2WD? Thanks!