4.2 Peripheral Input via GPIO Matrix
Refer to Section
4.11
4.2 Peripheral Input via GPIO Matrix
4.2.1 Summary
To receive a peripheral input signal via the GPIO Matrix, the GPIO Matrix is configured to source the peripheral
signal's input index (0-255) from one of the 40 GPIOs (0-39).
The input signal is read from the GPIO pad through the IO_MUX. The IO_MUX must be configured to set the
chosen pad to "GPIO" function. This causes the GPIO pad input signal to be routed into the GPIO Matrix which
in turn routes it to the selected peripheral input.
4.2.2 Functional Description
Figure
7
shows the logic for input selection via GPIO Matrix.
GPIO_FUNCy_IN_SEL
Peripheral Signal Y
To read GPIO pad
X
into peripheral signal Y, follow these steps:
1. Configure the GPIO_FUNCy_IN_SEL_CFG register for peripheral signal
• Set the GPIO_FUNCx_IN_SEL field to the number of the GPIO pad
2. Configure the GPIO_FUNCx_OUT_SEL_CFG and GPIO_ENABLE_DATA[x] for GPIO pad
Matrix:
• For input ony signals, the pad output can be disabled by setting the GPIO_FUNCx_OEN_SEL bits to
one and GPIO_ENABLE_DATA[x] to zero. Otherwise, there is no need to disable output.
3. Configure the IO_MUX register for GPIO pad X:
• Set the function field to GPIO.
• Enable the input by setting the xx_FUN_IE bit.
• Set xx_FUN_WPU and xx_FUN_WPD fields as desired to enable internal pull-up/pull-down resistors.
Espressif Systems
for a list of RTC IO_MUX functions.
In GPIO matrix
GPIO0_in
0
GPIO1_in
1
GPIO2_in
2
GPIO3_in
3
3
GPIOX_in
X
GPIO39_in
39
Constant 0 input
(0x30) 48
Constant 1 input
(0x38) 56
Figure 7: Peripheral Input via IO_MUX, GPIO Matrix
GPIO_SIGxx_IN_SEL
0
GPIO X in
1 (GPIO)
GPIOx_FUN_IE = 1
Y
in the GPIO Matrix:
X
29
ESP32 Technical Reference Manual V1.0
4 IO_MUX AND GPIO MATRIX
In IO MUX
GPIOx_MCU_SEL
0 (FUNC)
1 (FUNC)
I/O Pad X
2 (GPIO)
to read from.
X
in the GPIO
Need help?
Do you have a question about the ESP32 and is the answer not in the manual?
Questions and answers