Undo esp_rom_gpio_connect_out_signal

cruvus
Posts: 59
Joined: Fri Jul 08, 2022 5:08 pm
Location: Planet Earth

Undo esp_rom_gpio_connect_out_signal

Postby cruvus » Wed Mar 13, 2024 11:18 pm

Hi,

I have to use the function
esp_rom_gpio_connect_out_signal
to combine two signals. There is no real documentation for this function. In esp_rom_gpio.h it just says "Combine a peripheral signal which tagged as output attribute with a GPIO. There's no limitation on the number of signals that a GPIO can combine with."
How can I undo this connection? I do not want to reset all the config for this GPIO. Just undo what esp_rom_gpio_connect_out_signal did.
ESP32 / ESP-IDF 5.1.4

MicroController
Posts: 1725
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Undo esp_rom_gpio_connect_out_signal

Postby MicroController » Fri Mar 15, 2024 6:58 pm

If by 'undo' you mean disconnect the signal's output from the pad and the input, I believe setting the direction/"mode" to input (or, not-output) should be sufficient. I say 'believe' because the ESP32 TRM isn't too clear about it, while in the ESP32-S3's TRM we can see the workings of the the OE signal. Not sure if ESP32 and S3 differ in that regard. But trying it out shouldn't cause any harm :)

cruvus
Posts: 59
Joined: Fri Jul 08, 2022 5:08 pm
Location: Planet Earth

Re: Undo esp_rom_gpio_connect_out_signal

Postby cruvus » Sat Mar 16, 2024 12:01 am

I mean the exact same state as just before executing esp_rom_gpio_connect_out_signal(). The GPIOs are involved in a bus initialization (ESP-IDF API) I do not want to re-initialize the bus over and over again.
ESP32 / ESP-IDF 5.1.4

MicroController
Posts: 1725
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Undo esp_rom_gpio_connect_out_signal

Postby MicroController » Sat Mar 16, 2024 11:18 am

Start by reconnecting the signal that was connected before you called esp_rom_gpio_connect_out_signal().

cruvus
Posts: 59
Joined: Fri Jul 08, 2022 5:08 pm
Location: Planet Earth

Re: Undo esp_rom_gpio_connect_out_signal

Postby cruvus » Sat Mar 16, 2024 4:43 pm

That is the mystery. It is the MOSI pin, the one called mosi_io_num in spi_bus_config_t.
ESP32 / ESP-IDF 5.1.4

MicroController
Posts: 1725
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Undo esp_rom_gpio_connect_out_signal

Postby MicroController » Sat Mar 16, 2024 5:49 pm

You can draw inspiration from spicommon_bus_initialize_io(), or you can read the currently connected signal (MCU_SEL) from the corresponding IOMUX register before rerouting it.

Who is online

Users browsing this forum: No registered users and 329 guests