歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> S3C2440 UART2被配置為CTS問題解決

S3C2440 UART2被配置為CTS問題解決

日期:2017/3/1 11:18:16   编辑:Linux編程

Linux內核默認把uart2的功能設置為nRTS1、nTCTS1,沒有作為正常串口使用,如果我們想要將uart2作為串口,需要做以下修改:linux2.6內核將GPHCON寄存器的值置為0x16faaa就是說GPH6被設置為nRTS1,GPH7被設置為nCTS1,此時,串口2是無法收發數據的。

1、修改arch/arm/mach-s3c2440/mach-smdk2440.c中的uart2的配置,修改後如下:
static struct s3c2410_uartcfg smdk2440_uartcfgs[] __initdata = {
[0] = {
.hwport = 0,
.flags = 0,
.ucon = 0x3c5,
.ulcon = 0x03,
.ufcon = 0x51,
},
[1] = {
.hwport = 1,
.flags = 0,
.ucon = 0x3c5,
.ulcon = 0x03,
.ufcon = 0x51,
},

/* IR port */

[2] = {
.hwport = 2,
.flags = 0,
.ucon = 0x3c5,
.ulcon = 0x03,/*old0x43*/
.ufcon = 0x51,
}

};

2、vi drivers/serial/samsung.c
//增加以下頭文件
#include <linux/gpio.h>
#include <mach/regs-gpio.h>
在static int s3c24xx_serial_startup(struct uart_port *port)函數最後,添加
s3c2410_gpio_cfgpin(S3C2410_GPH(6), S3C2410_GPH6_TXD2);
s3c2410_gpio_pullup(S3C2410_GPH(6), 1);
s3c2410_gpio_cfgpin(S3C2410_GPH(7), S3C2410_GPH7_RXD2);

s3c2410_gpio_pullup(S3C2410_GPH(7), 1);

3、重新編譯zImage下載進開發板即可

Copyright © Linux教程網 All Rights Reserved