does esp32 support bi-direction gpio?

huntertfl
Posts: 1
Joined: Tue Nov 14, 2017 6:12 am

does esp32 support bi-direction gpio?

Postby huntertfl » Tue Nov 14, 2017 6:24 am

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.

User avatar
iot-bits.com
Posts: 25
Joined: Wed Dec 21, 2016 6:14 am
Location: India
Contact:

Re: does esp32 support bi-direction gpio?

Postby iot-bits.com » Wed Nov 15, 2017 3:13 pm

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?
- Pratik
:geek: Just another hobbyist and consultant

Who is online

Users browsing this forum: Baidu [Spider], Phillip and 91 guests