Browse Source

X1000:drv_uart.c:修复引脚路由中的问题/Fix bugs in pin routing

在配置引脚路由时需要将未使用的引脚配置为输入模式,
否则有可能同u-boot中的配置产生冲突。

Unused pins need to be configured as input mode when
configuring pin routing, otherwise there may be
conflicts with the configuration in u-boot.

Signed-off-by: Zhou Yanjie <zhouyanjie@zoho.com>
Zhou Yanjie 6 years ago
parent
commit
94a5f9951b
1 changed files with 4 additions and 1 deletions
  1. 4 1
      bsp/x1000/drivers/drv_uart.c

+ 4 - 1
bsp/x1000/drivers/drv_uart.c

@@ -285,11 +285,14 @@ void rt_hw_uart_init(void)
         strcpy(uart->name, "uart2");
 
 #ifdef CONFIG_SYS_UART2_PD
+        gpio_set_func(GPIO_PORT_C,GPIO_Pin_31,GPIO_INPUT | GPIO_PULL);
         gpio_set_func(GPIO_PORT_D,GPIO_Pin_4,GPIO_FUNC_0);
         gpio_set_func(GPIO_PORT_D,GPIO_Pin_5,GPIO_FUNC_0);
 #else
         //USE JTAG IO for UART2
-        gpio_set_func(GPIO_PORT_C,GPIO_Pin_31,GPIO_FUNC_1);
+        gpio_set_func(GPIO_PORT_D,GPIO_Pin_4,GPIO_INPUT | GPIO_PULL);
+        gpio_set_func(GPIO_PORT_D,GPIO_Pin_5,GPIO_INPUT | GPIO_PULL);
+        gpio_set_func(GPIO_PORT_C,GPIO_Pin_31,GPIO_FUNC_1 | GPIO_PULL);
 #endif
 
         serial->ops              = &_uart_ops;