您的位置:首页 > 其它

am335x 更改调试串口

2016-10-24 17:46 429 查看


am335x 更改调试串口

/*********************************************************************
*                  am335x 更改调试串口
*
*  am335x的调试串口是uart0,uart硬件连接上与其他功能出现了冲突。
*  打算将其更改为uart1。本文并没有全部更改成功。
*  记录其过程,方便以后继续尝试。
*
*                              Tony Liu, 2016-4-47, Shenzhen
*********************************************************************/
本文主要内容:
1. kernel调试串口更改
2. rootfs调试串口更改
3. uboot调试串口更改
参考链接: http://bbs.ednchina.com/BLOG_ARTICLE_3003157.HTM http://www.cnblogs.com/zym0805/archive/2011/07/17/2108573.html

1. kernel
1.1 更改kernel调试串口
通过uboot传参数,更改内核的uart端口,默认是ttyO0,更改为ttyO1
uboot/include/configs/ok335x.h
#define CON     \
"console=ttyO1,115200n8\0" \
"optargs=\0" \
"mmcroot=/dev/mmcblk0p2 ro\0" \
"mmcrootfstype=ext3 rootwait\0" \
"nandroot=ubi0:rootfs rw ubi.mtd=7,2048\0" \
"nandrootfstype=ubifs rootwait=1\0"
#endif
1.2 关闭kernel的调试串口
include/configs/ok335x.h
通过uboot传参数,更改内核的uart端口,默认是ttyO0,更改为ttynull
#define CON     \
"console=ttynull,115200n8\0" \
"optargs=\0" \
"mmcroot=/dev/mmcblk0p2 ro\0" \
"mmcrootfstype=ext3 rootwait\0" \
"nandroot=ubi0:rootfs rw ubi.mtd=7,2048\0" \
"nandrootfstype=ubifs rootwait=1\0"
#endif

2. rootfs
2.1  更改文件系统的调试端口
更改为ttyO1, getty命令用于设置uart的参数
/etc/inittab
0:2345:respawn:/sbin/getty 115200 ttyO1

2.2 关闭rootfs调试串口
将对应的行注释即可
/etc/inittab
#0:2345:respawn:/sbin/getty 115200 ttyO0

3. uboot
uboot中更改没有成功,但也把过程记录,方便之后查看。
uboot/include/configs/ok335x.h

更改下面的宏,注释的时候使用"/* */"进行注释,用“//”注释,编译会出现问题。
/* tony */
/*#define CONFIG_SERIAL2            1
#define CONFIG_CONS_INDEX        2
*/
#define CONFIG_SERIAL1            1
#define CONFIG_CONS_INDEX        1

//并添加下面两个宏, 定义UART1,UART2的寄存器地址
/* tony */
#define CONFIG_SYS_NS16550_COM2        0x48022000    /* UART1 */
#define CONFIG_SYS_NS16550_COM3        0x48024000    /* UART2 */
/*******/

board/forlinx/ok335x/pll.c
添加使能uart1
static void per_clocks_enable(void)
{
......
/* UART0 */
__raw_writel(PRCM_MOD_EN, CM_WKUP_UART0_CLKCTRL);
while (__raw_readl(CM_WKUP_UART0_CLKCTRL) != PRCM_MOD_EN);

/* UART1, add by Tony */
__raw_writel(PRCM_MOD_EN, CM_PER_UART1_CLKCTRL);
while (__raw_readl(CM_PER_UART1_CLKCTRL) != PRCM_MOD_EN);

/* UART3 */
__raw_writel(PRCM_MOD_EN, CM_PER_UART3_CLKCTRL);
while (__raw_readl(CM_PER_UART3_CLKCTRL) != PRCM_MOD_EN);
......
}

//添加uart1的时能
board/forlinx/ok335x/mux.c
void enable_uart1_pin_mux(void)
{
configure_module_pin_mux(uart1_pin_mux);
}

添加调用
board/forlinx/ok335x/evm.c
void s_init(void)
{
......
enable_uart0_pin_mux();
enable_uart1_pin_mux();
......
}


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: