ESP32 IO_MUX GPIO_MATRIX

Paul85
Posts: 3
Joined: Mon Jun 10, 2019 2:45 pm

ESP32 IO_MUX GPIO_MATRIX

Postby Paul85 » Wed Jan 08, 2020 4:40 pm

Hello,

I'm new in ESP32 programming. Reading di esp_idf documentation is seems that through IO_MUX and/or GPIO MATRIX most of the peripheals available can be assigned to any GPIO pin, but I cannot understand how to do that. Should I write a specific inizialization funtion for the pin assigment or should I use the menuconfig? Is there an example?

Thank you in advance,

Paul

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

Re: ESP32 IO_MUX GPIO_MATRIX

Postby ESP_Sprite » Thu Jan 09, 2020 3:03 am

In ESP-IDF, for most peripherals you will pass the pin number you want the signals on as parameters to the initialization function for the driver. The driver will then figure out how to tweak the GPIO matrix and/or IO mux to hook everything up correctly. Some examples in ESP-IDF do not hardcode the GPIO pin they pass to the drivers, but have a menuconfig option whose value gets passed on. You can copy that mechanism to your own projects as well, if you desire, but it's also perfectly acceptable to pass a hardcoded value to the driver.

Who is online

Users browsing this forum: Google [Bot] and 130 guests