Page 1 of 1

Is it capable for UART and SPI init function, their pins to be tied directly through IO_MUX

Posted: Wed Jan 20, 2021 11:03 am
by mbedninja
Аrе they (uart_set_pin( ... ) and spi_slave_initialize ( ... , &buscfg, ...)) smart enough to do that, if all the pins passed as parameter to them are the direct pins.

I made an experiment with the uart_set_pin and figured out that even the pins are the direct ones they are still routhed through the GPIO matrix. I explisitly should do the following to acomplish this:

Let say I want to use UART2:
so
if the Pin is input:

Code: Select all

gpio_iomux_out(16, FUNC_GPIO16_U2RXD, 0);
      gpio_iomux_in(16, U2RXD_IN_IDX);
and if it is output:

Code: Select all

gpio_iomux_out(17, FUNC_GPIO17_U2TXD, 0);
and after that:

Code: Select all

uart_set_pin(2, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE);
Is the same for SPI or

Code: Select all

buscfg.flags = SPICOMMON_BUSFLAG_NATIVE_PINS;
will make this for me and save me the headaches with

Code: Select all

gpio_iomux_out() & gpio_iomux_in()