uart是同i2c/spi一样,常用的通信接口,最常用的就是debug 串口,在龙芯2k0300开发板上,引出了4路,本文通过其与PC通信的方法,来测试其性能
在龙芯2k0300开发板上,引出了4路,其中1路作为调试串口使用(转成usb typec),其余3路如下所示
默认在设备树中,状态都设置为ok
默认定义为
uart2: serial@0x16100800 {
compatible = "ns16550a";
reg = <0 0x16100800 0 0x10>;
clock-frequency = <200000000>;
interrupt-parent = <&icu>;
interrupts = <2>;
no-loopback-test;
pinctrl-0 = <&uart2_pins>;
pinctrl-names = "default";
status = "disabled";
};
$ grep -rn ns16550a ./drivers/tty/
./drivers/tty/serial/8250/8250_port.c:1110: if (ns16550a_goto_highspeed(up))
./drivers/tty/serial/8250/8250_core.c:791: ns16550a_goto_highspeed(up);
./drivers/tty/serial/8250/8250.h:327:static inline int ns16550a_goto_highspeed(struct uart_8250_port *up)
./drivers/tty/serial/8250/8250_of.c:303: { .compatible = "ns16550a", .data = (void *)PORT_16550A, },
./drivers/tty/serial/8250/8250_early.c:180:OF_EARLYCON_DECLARE(ns16550a, "ns16550a", early_serial8250_setup);
使用蜂鸟上的串口与PC进行通过,电路如下所示
蜂鸟上跑应用程序,PC上通过串口调试助手发送与接收
[root@LS-GD home]# ./uart-app --help
./uart-app: unrecognized option '--help'
Usage: ./uart-app [-DSvfRs]
-D --device tty device to use
-S --speed uart speed
-v --verbose Verbose (show rx buffer)
-f --hardflow open hardware flowcontrol
-R --rs485 enable rs485 function
-s --savefile save rx data to file
[root@LS-GD home]# ./uart-app -D /dev/ttyS2 -S 115200 -v
tty device test ok.
press s to set modem, z to clear modem, g to get modem,b to send break, w to write, r to read, q for quit.
每秒发送1024个字节,发送大约5分钟
接收端最终显示
且停留在,感觉奔了。。。
链接:https://pan.baidu.com/s/1hMkNY_zq0nqxfFnH4VRbDQ
提取码:5bzm
百度网盘 提取码: 7ip6
更多回帖