4 IO_MUX and GPIO Matrix (GPIO, IO_MUX)
• The GPIO_ENABLE_DATA[x] field is a bit in either GPIO_ENABLE_REG (GPIOs 0-31) or GPIO_ENABLE1_REG
(GPIOs 32-39). Clear this bit to disable the output driver for the GPIO pad.
3. Configure the IO_MUX to select the GPIO Matrix. Set the IO_MUX_x_REG register corresponding to GPIO
pad
X
as follows:
• Set the function field (MCU_SEL) to the IO_MUX function corresponding to GPIO
2—numeric value 2—for all pins).
• Enable the input by setting the FUN_IE bit.
• Set or clear the FUN_WPU and FUN_WPD bits, as desired, to enable/disable internal pull-up/pull-
down resistors.
Notes:
• One input pad can be connected to multiple input_signals.
• The input signal can be inverted with GPIO_FUNCy_IN_INV_SEL.
• It is possible to have a peripheral read a constantly low or constantly high input value without connecting
this input to a pad. This can be done by selecting a special GPIO_FUNCy_IN_SEL input, instead of a GPIO
number:
– When GPIO_FUNCy_IN_SEL is 0x30,
– When GPIO_FUNCy_IN_SEL is 0x38,
For example, to connect RMT peripheral channel 0 input signal (RMT_SIG_IN0_IDX, signal index 83) to GPIO 15,
please follow the steps below. Note that GPIO 15 is also named the MTDO pin:
1. Set the GPIO_FUNC83_IN_SEL_CFG register field GPIO_FUNC83_IN_SEL value to 15.
2. As this is an input-only signal, set GPIO_FUNC15_OEN_SEL bit in GPIO_FUNC15_OUT_SEL_CFG_REG.
3. Clear bit 15 of GPIO_ENABLE_REG (field GPIO_ENABLE_DATA[15]).
4. Set the IO_MUX_GPIO15 register MCU_SEL field to 2 (GPIO function) and also set the FUN_IE bit (input
mode).
4.2.3 Simple GPIO Input
The GPIO_IN_REG/GPIO_IN1_REG register holds the input values of each GPIO pad.
The input value of any GPIO pin can be read at any time without configuring the GPIO Matrix for a particular
peripheral signal. However, it is necessary to enable the input in the IO_MUX by setting the FUN_IE bit in the
IO_MUX_x_REG register corresponding to pad X, as mentioned in Section 4.2.2.
4.3 Peripheral Output via GPIO Matrix
4.3.1 Summary
To output a signal from a peripheral via the GPIO Matrix, the GPIO Matrix is configured to route the peripheral
output signal (0-18, 23-37, 61-121, 140-125, 224-228) to one of the 28 GPIOs (0-19, 21-23, 25-27, 32-33).
The output signal is routed from the peripheral into the GPIO Matrix. It is then routed into the IO_MUX, which is
configured to set the chosen pad to "GPIO" function. This causes the output GPIO signal to be connected to
the pad.
Espressif Systems
input_signal_x
is always 0.
input_signal_x
is always 1.
51
Submit Documentation Feedback
X
(this is Function
ESP32 TRM (Version 5.2)
Need help?
Do you have a question about the ESP32 and is the answer not in the manual?