UART串口作为最为常用的工业设备接口之一被广泛且大量的应用,本文就基于Toradex ARM平台设备为例介绍WinCE下UART配置。
我们采用Colibri ARM核心板产品搭配
Colibri开发板来进行测试,OS为Toradex官方发布的最新版WinCE,其中Colibri系列默认定义了三个串口,UART A, UART B和UART C,其中UART A用作调试串口使用,下面就分别针对不同SoC产品进行说明。
1). 基于NXP i.MX6Solo/DualLite的Colibri i.MX6产品
系统默认定义COM 1 – UART A (调试串口,全功能);COM 2 – UART B (支持Flow control);COM 3 – UART C;另外还支持额外的两个串口UART D和UART E,默认没有使能;所有串口默认均为DTE模式。
./ 使能UART D方法,请在注册表中添加下面内容并保存
-----------------------------
[HKEY_LOCAL_MACHINEDriversBuiltInCOM4]
"Order"=dword:00000002
"IoLen"=dword:000000d4
"IoBase"=dword:021f0000
"Index"=dword:00000004
"DeviceArrayIndex"=dword:00000003
"Prefix"="COM"
"Dll"="csp_serial.dll"
[HKEY_LOCAL_MACHINEDriversBuiltInCOM4Unimodem]
"DevConfig"=hex:10,00,00,00,05,00,00,00,10,01,00,00,00,4B,00,00,00,00,08,00,00,00,00,00,00
"DeviceType"=dword:00000000
"Tsp"="Unimodem.dll"
"FriendlyName"="COM4 UNIMODEM"
[HKEY_LOCAL_MACHINEDriversBuiltInCOM4Pinout_Default]
"colibripin_165"="altfn=3"
"colibripin_167"="altfn=3"
-----------------------------
./ 使能UART E方法,请在注册表中添加下面内容并保存
-----------------------------
[HKEY_LOCAL_MACHINEDriversBuiltInCOM5]
"Order"=dword:00000002
"IoLen"=dword:000000d4
"IoBase"=dword:021f4000
"Index"=dword:00000005
"DeviceArrayIndex"=dword:00000004
"Prefix"="COM"
"Dll"="csp_serial.dll"
[HKEY_LOCAL_MACHINEDriversBuiltInCOM5Unimodem]
"DevConfig"=hex:10,00,00,00,05,00,00,00,10,01,00,00,00,4B,00,00,00,00,08,00,00,00,00,00,00
"DeviceType"=dword:00000000
"Tsp"="Unimodem.dll"
"FriendlyName"="COM5 UNIMODEM"
[HKEY_LOCAL_MACHINEDriversBuiltInCOM5Pinout_Default]
"colibripin_169"="altfn=3"
"colibripin_171"="altfn=3"
-----------------------------
2). 基于NXP Vybrid的Colibri VF50/VF61产品
系统默认定义COM 1 – UART A (调试串口,全功能控制引脚需使用GPIO);COM 2 – UART B (支持Flow control);COM 3 – UART C;另外还支持额外的两个串口UART D和UART E,默认没有使能。
./ 使能UART D方法,请在注册表中添加下面内容并保存
-----------------------------
[HKEY_LOCAL_MACHINEDriversBuiltInUARTD]
"DeviceArrayIndex"=dword:00000003
"Index"=dword:00000004
"Prefix"="COM"
"Dll"="vybrid_serial.dll"
"Order"=dword:00000001
"TXPIN"=dword:00000017
"TXAF"=dword:00000006
"RXPIN"=dword:0000001f
"RXAF"=dword:00000006
-----------------------------
./ 使能UART E方法,由于管脚和Colibir默认定义的SDHC接口冲突,因此需先关闭SDHC功能,请在注册表中修改下面内容并保存
-----------------------------
[HKEY_LOCAL_MACHINEDriversBuiltInESDHC]
"Dll"="_esdhc.dll"
[HKEY_LOCAL_MACHINEDriversBuiltInUARTE]
"DeviceArrayIndex"=dword:00000004
"Index"=dword:00000005
"Prefix"="COM"
"Dll"="vybrid_serial.dll"
"Order"=dword:00000001
"TXPIN"=dword:00000033
"TXAF"=dword:00000004
"RXPIN"=dword:00000035
"RXAF"=dword:00000004
-----------------------------
3). 基于nVidia Tegra的Colibri T20/T30产品
系统默认定义COM 1 – UART A (UART 1,调试串口,全功能串口);COM 2 – UART B (UART 4, 支持Flow control);COM 3 – IrDA (WinCE6) 或UART C (WEC7)(UART2);另外还支持额外的两个串口UART 3和UART 5,默认没有使能。
./ WinCE6下COM 3 设置为普通串口方法,注册表如下修改
-----------------------------
[HKLMDriversBuiltInSerial3]
" IrConnected"=dword:00000000
[HKLMCommIRSIR]
" ImagePath "=" _irsir.dll "
-----------------------------
./ UART3 Pin脚定义
SODIMM Pin 115 (GMI_A2) – UART3 TxD
SODIMM Pin 117(GMI_A3) – UART3 RxD
./ 使能UART 3方法,请在注册表中添加下面内容并保存
-----------------------------
[HKEY_LOCAL_MACHINEDriversBuiltInSerial4]
"DeviceArrayIndex"=dword:00000083
"Prefix"="COM"
"Dll"="libnvuart.dll"
"Order"=dword:00000004
"Index"=dword:00000004
"IClass"=hex(7):7b,00,41,00,33,00,32,00,39,00,34,00,32,00,42,00,37,00,2d,00,39,00,32,00,30,
00,43,00,2d,00,34,00,38,00,36,00,62,00,2d,00,42,00,30,00,45,00,36,00,2d,00,
39,00,32,00,41,00,37,00,30,00,32,00,41,00,39,00,39,00,42,00,33,00,35,00,7d,
00,00,00,00,00
[HKEY_LOCAL_MACHINEDriversBuiltInSerial4Unimodem]
"Tsp"="Unimodem.dll"
"DeviceType"=dword:00000000
"FriendlyName"="Serial on COM4:"
"DevConfig"=hex:10,00,00,00,05,00,00,00,10,01,00,00,00,4b,00,00,00,00,08,00,00,00,00,00,00
-----------------------------
./ UART5 Pin脚定义
SODIMM Pin 192 – UART5 TxD
SODIMM Pin 49 – UART5 RxD
./ 使能UART 5方法,由于管脚和Colibir默认定义的SDIO接口冲突,因此需先关闭SDIO功能,请在注册表中修改下面内容并保存
-----------------------------
[HKEY_LOCAL_MACHINEDriversBuiltInSDIO]
"Dll"="_libnvsdio.dll"
[HKEY_LOCAL_MACHINEDriversBuiltInSerial5]
"DeviceArrayIndex"=dword:00000084
"Prefix"="COM"
"Dll"="libnvuart.dll"
"Order"=dword:00000004
"Index"=dword:00000005
"IClass"=hex(7):7b,00,41,00,33,00,32,00,39,00,34,00,32,00,42,00,37,00,2d,00,39,00,32,00,30,
00,43,00,2d,00,34,00,38,00,36,00,62,00,2d,00,42,00,30,00,45,00,36,00,2d,00,
39,00,32,00,41,00,37,00,30,00,32,00,41,00,39,00,39,00,42,00,33,00,35,00,7d,
00,00,00,00,00
[HKEY_LOCAL_MACHINEDriversBuiltInSerial5Unimodem]
"Tsp"="Unimodem.dll"
"DeviceType"=dword:00000000
"FriendlyName"="Serial on COM5:"
"DevConfig"=hex:10,00,00,00,05,00,00,00,10,01,00,00,00,4b,00,00,00,00,08,00,00,00,00,00,00
-----------------------------
4). 关于UART更详细的说明请见这里,另外如何调用Lib库来访问UART请见这里。