gpio_matrix_in or gpio_matrix_out vs. gpio_set_direction

User avatar
rudi ;-)
Posts: 1727
Joined: Fri Nov 13, 2015 3:25 pm

gpio_matrix_in or gpio_matrix_out vs. gpio_set_direction

Postby rudi ;-) » Sat Mar 11, 2017 10:24 am

hi guys

honest, have thinked

Code: Select all

gpio_matrix_out(PIN_SMI_MDIO, EMAC_MDO_O_IDX, 0, 0);
gpio_matrix_in(PIN_SMI_MDIO, EMAC_MDI_I_IDX, 0);
set the Direction BIT of the GPIO
in this example MDIO is in and output
https://esp32.com/viewtopic.php?f=12&p=6422#p6401


? we need to set the BIT again for input with
https://esp32.com/viewtopic.php?f=12&p=6422#p6418

Code: Select all

gpio_set_direction(PIN_SMI_MDIO, GPIO_MODE_INPUT);

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

User avatar
rudi ;-)
Posts: 1727
Joined: Fri Nov 13, 2015 3:25 pm

Re: gpio_matrix_in or gpio_matrix_out vs. gpio_set_direction

Postby rudi ;-) » Wed Mar 15, 2017 9:27 am

hi guys

sry for the push
but for me this is honest not clear 100 procent

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: gpio_matrix_in or gpio_matrix_out vs. gpio_set_direction

Postby ESP_igrr » Wed Mar 15, 2017 1:59 pm

No, gpio_matrix_in doesn't set input enable. It only writes to the GPIO_FUNCx_IN_SEL_CFG_REG register.

User avatar
rudi ;-)
Posts: 1727
Joined: Fri Nov 13, 2015 3:25 pm

Re: gpio_matrix_in or gpio_matrix_out vs. gpio_set_direction

Postby rudi ;-) » Wed Mar 15, 2017 3:04 pm

ESP_igrr wrote:No, gpio_matrix_in doesn't set input enable. It only writes to the GPIO_FUNCx_IN_SEL_CFG_REG register.

ok,
i must ask again:
here in this example: GPIO18
https://github.com/espressif/esp-idf/bl ... main.c#L42

is used for MDIO
https://github.com/espressif/esp-idf/bl ... ain.c#L138

why we need not use

Code: Select all

gpio_set_direction(PIN_SMI_MDIO, GPIO_MODE_INPUT); 
that the pin is input mode

if we use example gpio32 or 33

we need explizite to use

Code: Select all

gpio_set_direction(PIN_SMI_MDIO, GPIO_MODE_INPUT); 
that the gpio32 or gpio33 is in INPUT mode too.

https://esp32.com/viewtopic.php?f=12&t= ... 6508#p6458

is mean GPIO_FUNCx_IN_SEL_CFG_REG is not valid for "GPIO MODE" that then is used for FUNC set pin?
other words:

if we use other function of GPIO as there is named as "FUNC" PIN "NAME"
( use function1 gpio )
then we need to use the GPIO API for set it as INPUT pin by using gpio_set_direction too?

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: gpio_matrix_in or gpio_matrix_out vs. gpio_set_direction

Postby ESP_igrr » Thu Mar 16, 2017 8:23 am

I think the difference you see between GPIO18 and GPIO32 is that GPIO18 has "input enable" bit set by default, while GPIO32 has this bit cleared when it gets configured as an XTAL input pin during startup. This is why you need to set "input enable" for GPIO32 explicitly.

User avatar
rudi ;-)
Posts: 1727
Joined: Fri Nov 13, 2015 3:25 pm

Re: gpio_matrix_in or gpio_matrix_out vs. gpio_set_direction

Postby rudi ;-) » Thu Mar 16, 2017 8:39 am

now is clear.
thank you.

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

Who is online

Users browsing this forum: No registered users and 141 guests