Hi
I know that GPIO 34 to 39 are meany for input only, however I was wondering if it's possible to map an SPi or I2C periperal to them? My projects has few inputs and many outputs so ideally so as not to run out it would be nice to use the SENSOR_VP / SENSOR_VN as SDA / SCL
Regards
John
Use of GPIO34 - 39 for I2C?
-
- Posts: 9709
- Joined: Thu Nov 26, 2015 4:08 am
Re: Use of GPIO34 - 39 for I2C?
These pins are always inputs, independent if they're driven from a peripheral or as GPIOs. So for example mapping I2C to them isn't going to work, because both scl as well as sda are inputs as well as outputs. Mapping e.g. the MISO pin of SPI to them would work, because (unless you use quad-IO SPI mode) that always is an input.
-
- Posts: 3
- Joined: Wed Apr 12, 2017 3:42 pm
Re: Use of GPIO34 - 39 for I2C?
Thank for the info. Guess I will have to live with that
Re: Use of GPIO34 - 39 for I2C?
IO34-IO39 without SPI funtion in IO_MUX table. Is true for IO34-IO39 can map to SPI MISO funtion?
Re: Use of GPIO34 - 39 for I2C?
Yes via gpio matrix not io_mux
Re: Use of GPIO34 - 39 for I2C?
With the current ESP-IDF V3.0, I'm finding that this doesn't work. I'm trying to use GPI34 as a SPI MISO input.ESP_Sprite wrote:Mapping e.g. the MISO pin of SPI to them would work because (unless you use quad-IO SPI mode) that always is an input.
If I understand correctly what is going on, the reason it doesn't work is because in file esp-idf/components/driver/spi_common.c, an attempt is made to configure the port specified for use as SPI MISO as Input+Output rather than just Input. See the gpio_set_direction() call here:
Code: Select all
if (bus_config->miso_io_num >= 0) {
PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[bus_config->miso_io_num], PIN_FUNC_GPIO);
gpio_set_direction(bus_config->miso_io_num, GPIO_MODE_INPUT_OUTPUT);
gpio_matrix_out(bus_config->miso_io_num, io_signal[host].spiq_out, false, false);
gpio_matrix_in(bus_config->miso_io_num, io_signal[host].spiq_in, false);
}
Code: Select all
gpio_set_direction(bus_config->miso_io_num, GPIO_MODE_INPUT);
If so, where can I report the bug? At http://bbs.esp32.com/viewforum.php?f=14 ... de9c05b564?
Cheers,
JB.
Re: Use of GPIO34 - 39 for I2C?
I confirm that with this change:
- The spi_bus_initialize() call completes without error.
- The SPI port works correctly, including inputing data from input-only (GPI) ports.
Who is online
Users browsing this forum: No registered users and 191 guests