IO複用情況LPC3250 的7個串口中的UART1/2/7是高速串口。其中的IO複用見 LPC3250串口IO複用情況。 高速串口不能使用文檔描述:Enable the LPC32xx high speed serial ports in the kernel driver configuration and selectwhich high speed serial ports of the 3 you want to use in the Linux kernel configurationSystem Type--> menu. Add the device nodes to the /dev are using the following command:[root@nxp /root]# mknod /dev/ttyTX0 c 204 196[root@nxp /root]# mknod /dev/ttyTX1 c 204 197[root@nxp /root]# mknod /dev/ttyTX2 c 204 198 已經根據文檔,使能了高速串口:## High speed UARTS#CONFIG_MACH_LPC32XX_HSUART1_ENABLE=yCONFIG_MACH_LPC32XX_HSUART2_ENABLE=yCONFIG_MACH_LPC32XX_HSUART7_ENABLE=y 但是,系統啟動資訊並沒有任何有關於高速串口的提示,使用mknod命令建立裝置節點後,往該節點發送字元,提示錯誤:[root@nxp root]# mknod /dev/ttyTX0 c 204 196[root@nxp root]# echo hello >/dev/ttyTX0-sh: /dev/ttyTX0: No such device or address 而往普通串口發送是正常的:[root@nxp root]# echo hello >/dev/ttyS1[root@nxp root]# echo hello >/dev/ttyS2[root@nxp root]# echo hello >/dev/ttyS3[root@nxp root]# echo hello >/dev/ttyS0hello[root@nxp root]# 解決 原來是裝置驅動的串口,在非標準串口部分將LPC32XX的高速串口配置後即可。 <*> LPC32xx high serial port support 核心設定檔:## Non-8250 serial port support## CONFIG_SERIAL_AMBA_PL010 is not set# CONFIG_SERIAL_AMBA_PL011 is not setCONFIG_SERIAL_HS_LPC32XX=y 啟動資訊:CLCD: Phytec LCD hardware, QVGA portrait displayConsole: switching to colour frame buffer device 30x40Serial: 8250/16550 driver4 ports, IRQ sharing disabledserial8250.0: ttyS0 at MMIO 0x40090000 (irq = 9) is a 16550Aconsole [ttyS0] enabledserial8250.0: ttyS1 at MMIO 0x40080000 (irq = 7) is a 16550Aserial8250.0: ttyS2 at MMIO 0x40088000 (irq = 8) is a 16550Aserial8250.0: ttyS3 at MMIO 0x40098000 (irq = 10) is a 16550Alpc32xx_hsuart.0: ttyTX0 at MMIO 0x40014000 (irq = 26) is a lpc32xx_hsuartlpc32xx_hsuart.0: ttyTX1 at MMIO 0x40018000 (irq = 25) is a lpc32xx_hsuartlpc32xx_hsuart.0: ttyTX2 at MMIO 0x4001c000 (irq = 24) is a lpc32xx_hsuartloop: module loadedLPC32XX_mii_bus: probed 使用了udev後,無需手動建立裝置節點了,在/dev/目錄下已經有了ttyTX0~2節點,再次發送字元,可以正常了:[root@nxp root]# ls /dev/ttyTX*/dev/ttyTX0 /dev/ttyTX1 /dev/ttyTX2[root@nxp root]# echo hello>/dev/ttyTX0[root@nxp root]# echo hello>/dev/ttyTX1[root@nxp root]# echo hello>/dev/ttyTX2[root@nxp root]# 總結 為了更加方便實用,最好修改核心設定檔,在選中CONFIG_MACH_LPC32XX_HSUART1_ENABLECONFIG_MACH_LPC32XX_HSUART2_ENABLECONFIG_MACH_LPC32XX_HSUART7_ENABLE 中的任何一個,都同時選中CONFIG_SERIAL_HS_LPC32XX,保證高速串口可以玩完全使用。 實際測試 目前還沒有仔細配置IO複用情況,高速串口測試如下:ttyTX0——UART1,能發能收ttyTX1——UART2,能發不能收ttyTX2——UART7,不能收發 新版本問題 2009-06-01,新版本的晶片高速串口不能使用,不能進行收發,引腳無訊號。後來重新設定了UART_LOOP,禁止了全部串口的loopback功能,引腳有訊號了:檔案:arch/arm/mach-lpc32xx/board-smartarm3250.c601 //ABING602 __raw_writel(0, io_p2v(0x40054008)); //turn off all uart's loopback 但是傳輸速率不對,程式設定為115200,PC機需要使用128000才能正確接收。 傳輸速率問題解決,drivers/serial/hs_serial_lpc32xx.c檔案中計算有BUG,進行了如下修正,注釋了73~76的代碼:70 /* Find the closest divider to get the desired clock rate */71 div = uartclk / rate;72 hsu_rate = (div / 14) - 1;73 // if (hsu_rate != 0)74 // {75 // hsu_rate--;76 // }