GPIO16/17 initialization issues

iosixllc
Posts: 71
Joined: Fri Mar 17, 2017 12:13 am

GPIO16/17 initialization issues

Postby iosixllc » Wed Apr 19, 2017 7:10 am

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!

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: GPIO16/17 initialization issues

Postby ESP_igrr » Wed Apr 19, 2017 8:27 am

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

iosixllc
Posts: 71
Joined: Fri Mar 17, 2017 12:13 am

Re: GPIO16/17 initialization issues

Postby iosixllc » Thu Apr 20, 2017 6:46 pm

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!

Who is online

Users browsing this forum: pmi2410 and 214 guests