This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

使用普通GPIO作为UART使用的配置方法



大家好,我的板子现在想使用一个普通GPIO(没有UART复用功能)作为UART3_RXD进行使用,比如使用MCASP0_AXR1(GPIO3_20),然后我在uboot的mux.c对其配置如下:

tatic struct module_pin_mux uart3_pin_mux[] = {
{OFFSET(mcasp0_axr1), (MODE(7) | PULLUP_EN | RXACTIVE)}, /* UART3_RXD */
{OFFSET(ecap0_in_pwm0_out), (MODE(1) | PULLUDEN)}, /* UART3_TXD */
{-1},
};

dts文件配置如下:

uart3_pins: pinmux_uart3_pins {
pinctrl-single,pins = <
0x1A8 ( PIN_INPUT_PULLUP | MUX_MODE7 ) /**/
0x164 ( PIN_OUTPUT | MUX_MODE1 ) /* (C18) eCAP0_in_PWM0_out.uart3_txd */
>;
};

uart3_pins_sleep: pinmux_uart3_pins_sleep {
pinctrl-single,pins = <
0x1A8 ( PIN_INPUT_PULLDOWN | MUX_MODE7 ) /**/
0x164 ( PIN_INPUT_PULLDOWN | MUX_MODE7 ) /* (C18) eCAP0_in_PWM0_out.uart3_txd */
>;
};

&uart3 {
pinctrl-names = "default";
pinctrl-0 = <&uart3_pins>;
pinctrl-1 = <&uart3_pins_sleep>;

status = "okay";
};

现在我的UART3能正常发送数据,但是不能接收数据,我现在有两个问题:

1、这样使用是否可以?

2、如果可以,配置是否正确?应该如何配置?

谢谢!