Steer GPIO input to GPIO output?

toybuilder
Posts: 5
Joined: Thu Jan 31, 2019 6:02 pm

Steer GPIO input to GPIO output?

Postby toybuilder » Mon Feb 25, 2019 2:28 pm

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

ESP_Sprite
Posts: 9746
Joined: Thu Nov 26, 2015 4:08 am

Re: Steer GPIO input to GPIO output?

Postby ESP_Sprite » Tue Feb 26, 2019 7:28 am

If memory serves, you can use the same numbers (224-228) for inputs as well.

papaluna
Posts: 50
Joined: Tue Jan 30, 2018 11:27 am

Re: Steer GPIO input to GPIO output?

Postby papaluna » Tue Feb 26, 2019 7:49 am

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);
--
Paul.

toybuilder
Posts: 5
Joined: Thu Jan 31, 2019 6:02 pm

Re: Steer GPIO input to GPIO output?

Postby toybuilder » Wed Feb 27, 2019 10:34 pm

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!

Who is online

Users browsing this forum: Apostal2008 and 26 guests