串口位置
下表罗列了40PIN连接器可以用做UART功能的引脚,目前除了debug串口以外还可以扩展5路独立串口。最大波特率1.5M。IO电平是TTL 3.3V。注意:串口号和实际系统的节点不是一一对应,实际操作需要按照表格对应的设备节点。
序号 |
端口定义 |
描述 |
IO电平 |
设备节点 |
29 |
UART0_TX_M2 |
UART0 发送 |
TTL 3.3V |
/dev/ttyS6 |
31 |
UART0_RX_M2 |
UART0 接收 |
TTL 3.3V |
/dev/ttyS6 |
33 |
UART3_TX_M2 |
UART3 发送 |
TTL 3.3V |
/dev/ttyS3 |
35 |
UART3_RX_M2 |
UART3 接收 |
TTL 3.3V |
/dev/ttyS3 |
19 |
UART4_RX_M2 |
UART4 接收 |
TTL 3.3V |
/dev/ttyS4 |
23 |
UART4_TX_M2 |
UART4 发送 |
TTL 3.3V |
/dev/ttyS4 |
16 |
UART6_TX_M1 |
UART6 发送 |
TTL 3.3V |
/dev/ttyS2 |
18 |
UART6_RX_M1 |
UART6 接收 |
TTL 3.3V |
/dev/ttyS2 |
24 |
UART7_RX_M2 |
UART7 接收 |
TTL 3.3V |
/dev/ttyS7 |
26 |
UART7_TX_M2 |
UART7 发送 |
TTL 3.3V |
/dev/ttyS7 |
DTS配置
用户需要使用哪个串口在DTS打开对应节点即可,status = "okay"代表开启,status = "disabled"代表关闭。注意不使用UART功能确保对应节点的status是disabled状态,否则可能会导致其它功能异常。
&uart0 {
pinctrl-names = "default";
pinctrl-0 = <&uart0m2_xfer>;
status = "okay";
};
&uart3 {
pinctrl-names = "default";
pinctrl-0 = <&uart3m2_xfer>;
status = "okay";
};
&uart4 {
pinctrl-names = "default";
pinctrl-0 = <&uart4m2_xfer>;
status = "okay";
};
&uart6 {
pinctrl-names = "default";
pinctrl-0 = <&uart6m1_xfer>;
status = "okay";
};
&uart7 {
pinctrl-names = "default";
pinctrl-0 = <&uart7m2_xfer>;
status = "okay";
};
shell测试命令
功能测试采用回环测试(对应串口的TX RX信号短接)。
stty -F /dev/ttyS6 raw speed 115200 //配置PIN29 PIN31对应的串口波特率为115200
echo "hello world" > /dev/ttyS6 //发送字符串
cat /dev/ttyS6 //接收字符串
RS232电路

SIT3232EEAE.PDF
隔离485电路

UTRS485G.PDF
CA-IS3722LS.PDF
B0505S-1W.PDF