Page 1 of 1

does esp32 support bi-direction gpio?

Posted: Tue Nov 14, 2017 6:24 am
by huntertfl
Use ESP32 to access A7108, a 433M transceiver, which requires 3-line SPI interface, through spec, the data pin is bi-direction,
I configured GPIO21 as GPIO_MODE_INPUT_OUTPUT mode:

#define GPIO_DATA 21
#define GPIO_IO_PIN_SEL (((uint64_t)1)<<GPIO_DATA)
...
io_conf.pin_bit_mask = GPIO_IO_PIN_SEL;
//set as input&output mode
io_conf.mode = GPIO_MODE_INPUT_OUTPUT;
//disable pull-down mode, external pull up
io_conf.pull_down_en = 0;
//enable pull-up mode
io_conf.pull_up_en = 0;
gpio_config(&io_conf);

but the value read by gpio_get_level is the last value set by gpio_set_level, not the register value. Not sure if esp32 really support bi-direction IO access.

Re: does esp32 support bi-direction gpio?

Posted: Wed Nov 15, 2017 3:13 pm
by iot-bits.com
Setting SPI_SIO bit in SPI_USER_REG will enable pin sharing where MISO and MOSI will use the same physical pin for half-duplex communication. So yes, there is hardware support for that. ESP8266 had it too.
When you attach SPI peripheral to a GPIO pad, what do you get?