Page 1 of 1

Steer GPIO input to GPIO output?

Posted: Mon Feb 25, 2019 2:28 pm
by toybuilder
In the TRM's section on peripheral output via the GPIO matrix, there are some details that seem to suggest that signals can be steered from one GPIO pin to another GPIO pin. I've used such a technique with Cypress PSoC's and would love to be able to do it with the ESP32!

The GPIO Matrix table shows output signals 224-228 as sig_in_funcN -- but makes no mention of mapping the input side signal.
Does the steering of IO from input to output work? From looking at the API, it wasn't clear that I can make this mapping through calls and that I might have to experiment with writing to the registers directly?

Image

Thanks,
Joseph

Re: Steer GPIO input to GPIO output?

Posted: Tue Feb 26, 2019 7:28 am
by ESP_Sprite
If memory serves, you can use the same numbers (224-228) for inputs as well.

Re: Steer GPIO input to GPIO output?

Posted: Tue Feb 26, 2019 7:49 am
by papaluna
toybuilder wrote:
Mon Feb 25, 2019 2:28 pm
Does the steering of IO from input to output work?
Yes it works.

An example which routes the incoming signal on input pin GPIO_NUM_INPUT (#14) to the output pin corresponding with the on-board LED (#13) of an Huzzah32 dev board:

Code: Select all

    //  @doc Only the loopback signals 224-228 can be configured to be routed from one input GPIO and directly to another output GPIO.
    gpio_matrix_in(GPIO_NUM_INPUT, SIG_IN_FUNC228_IDX, false);
    gpio_matrix_out(HUZZAH32_GPIO_NUM_LED, SIG_IN_FUNC228_IDX, false, false);

Re: Steer GPIO input to GPIO output?

Posted: Wed Feb 27, 2019 10:34 pm
by toybuilder
Terrific. Thank you everyone!

Paul, thank you for posting the code snippet -- I was able to drop that into my ESP32/Arduino code and use it right away, making the ESP32 act as a serial loopback for the FTDI USB/serial interface that is connected to it, and then extending that further to be a cross-point between multiple serial devices. This gives me a great starting place to finish the rest of my design!