Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set MATRIX_DETACH_* values based on TRM #8345

Merged
merged 1 commit into from
Jul 17, 2023

Conversation

colincross
Copy link
Contributor

@colincross colincross commented Jun 24, 2023

Description of Change

The MATRIX_DETACH_* values vary by platform, which is not documented in the gpio_matrix_out or gpio_matrix_in functions (espressif/esp-idf#11737). Use the SDK macros that contain the correct values for all platforms.

Tests scenarios

Tested on an Adafruit Qt Py ESP32-C3 board.

Tested pinMatrixInDetach by using pinMatrixInAttach to connect an input pin to the cpu_gpio_in0 signal, then use pinMatrixInDetach with low and high values and verified that they propagated to cpu_gpio_in0 read with the CSRR instruction on CSR 0x804.

Tested pinMatrixOutDetach on an output pin and verified that it was still driven.

Without this patch both tests fail.

Tested with ESP-IDF 4.4.3 and arduino-esp32 72c41d0.

Related links

espressif/esp-idf#11737

@CLAassistant
Copy link

CLAassistant commented Jun 24, 2023

CLA assistant check
All committers have signed the CLA.

The constants that need to be passed to gpio_matrix_in and gpio_matrix_out
to detach an input or output pin from a peripheral vary by platform.  Use
SIG_GPIO_OUT_IDX to detach an output, and GPIO_MATRIX_CONST_ONE_INPUT
and GPIO_MATRIX_CONST_ZERO_INPUT to detach an input.  ESP32 before IDF 4.0
didn't define GPIO_MATRIX_CONST_*_INPUT, so add compatibility #defines
for GPIO_FUNC_IN_LOW/HIGH.  GPIO_FUNC_IN_LOW/HIGH exist in IDF 4.0+, but
can't be used because they have the wrong values for ESP32-C3 at least
in IDF 4.4.3 (espressif/esp-idf#11737).
@colincross colincross force-pushed the esp32c3_gpio_matrix_out branch from 8ecdb4c to 5591c29 Compare June 25, 2023 05:29
@me-no-dev me-no-dev merged commit 289c2a1 into espressif:master Jul 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants