CPU型号:MX515
CPU核:ARM CORTEXA8
mx51 uboot 改变控制台
Freescale uboot_imx 默认使用uart1作为console即控制台,我们的项目uart2和单片机通讯。
为了方便调试,测试UART2,我把UART2作为console,可以排除UART2的代码设置问题。
其方法如下:
1.在配置文件中设置UART2
feilong@feilong-desktop:~/uboot-imx$ svn diff include/configs/mx51_vdphone.h
Index: include/configs/mx51_vdphone.h
===================================================================
--- include/configs/mx51_vdphone.h (revision 184)
+++ include/configs/mx51_vdphone.h (working copy)
@@ -68,7 +68,8 @@
* Hardware drivers
*/
#define CONFIG_MX51_UART 1
-#define CONFIG_MX51_UART1 1
+//#define CONFIG_MX51_UART1 1
+#define CONFIG_MX51_UART2 1
@@ -118,7 +119,7 @@
/* allow to overwrite serial and ethaddr */
#define CONFIG_ENV_OVERWRITE
-#define CONFIG_CONS_INDEX 1
+#define CONFIG_CONS_INDEX 2
#define CONFIG_BAUDRATE 115200
#define CONFIG_SYS_BAUDRATE_TABLE {9600, 19200, 38400, 57600, 115200}
2.在板子初始化文件中配置UART2引脚为UART2模式
feilong@feilong-desktop:~/uboot-imx$ svn diff board/freescale/mx51_bbg/mx51_bbg.c
Index: board/freescale/mx51_bbg/mx51_bbg.c
===================================================================
--- board/freescale/mx51_bbg/mx51_bbg.c (revision 136)
+++ board/freescale/mx51_bbg/mx51_bbg.c (working copy)
@@ -238,6 +238,20 @@
writel(0x00000004, 0x73fa83ec);
}
+static void setup_uart2(void)
+{
+ unsigned int pad = PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE |
+ PAD_CTL_PUE_PULL | PAD_CTL_DRV_HIGH;
+ mxc_request_iomux(MX51_PIN_UART2_RXD, IOMUX_CONFIG_ALT0);
+ mxc_iomux_set_pad(MX51_PIN_UART2_RXD, pad | PAD_CTL_SRE_FAST);
+ mxc_request_iomux(MX51_PIN_UART2_TXD, IOMUX_CONFIG_ALT0);
+ mxc_iomux_set_pad(MX51_PIN_UART2_TXD, pad | PAD_CTL_SRE_FAST);
+ /* enable GPIO1_9 for CLK0 and GPIO1_8 for CLK02 */
+ writel(0x00000004, 0x73fa83e8);
+ writel(0x00000004, 0x73fa83ec);
+}
+
+
void setup_nfc(void)
{
/* Enable NFC IOMUX */
@@ -711,6 +725,7 @@
gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
setup_uart();
+ setup_uart2();
setup_nfc();
setup_expio();
setup_fec();
feilong@feilong-desktop:~/uboot-imx$