|
导入:
从事嵌入式开发的朋友都懂,拿到新板子,第一件事就是验证硬件资源够不够用——存储读写速率多少?千兆网口能不能跑满?摄像头能同时带几路? 本系列将围绕眺望Pi-RK3572工业派的四大模块(存储、多媒体、网络、工业通信),完整呈现测试环境、设计原理、操作方法、指令和实测结果。如工业派的初衷,不是做“功能验证工具”,而是成为“可量产、可交付、可信赖”的基座平台,帮大家少走弯路。 本期聚焦:眺望Pi-RK3572工业派网络相关接口的测试方法与性能基准,包括以太网、WIFI、蓝牙、4G等模块。 一、网络配置一览 1.1 网络配置解析 Pi-RK3572集成了2个千兆以太网控制器(GMAC),支持RGMII/RMII接口,具备10/100/1000Mbps自适应速率,为构建高可靠性的冗余网络或充当网络网关提供了硬件基础;还板载了WIFI模块、蓝牙模块和4G模块,方便产品快速接入物联网。 二、网络实测 测试环境 硬件环境:Pi-RK3572工业派 Windows开发环境:Windows10 64bit Linux开发环境:VMware16.2.5、Ubuntu22.04 64bit 测试固件:4-软件资料\2-系统固件\1-talowe-rk3572-buildroot-TFcard-260806.img SDK开发包:4-软件资料\1-RK3572_Linux_SDK源码\1-talowe-rk3572-linux6.12.tar.gz 备注:本文所有测试均在 64GB eMMC、4GB LPDDR5X 配置的核心板上完成。受硬件配置、软件版本及测试环境等因素影响,不同型号或配置的核心板测试结果可能存在一定差异,具体请以实际测试结果为准。 2.1 以太网测试 Pi-RK3572底板上板载两路千兆以太网接口。 2.1.1查看网络节点 - <font color="#000000" face="宋体"><span style="font-size: 10.5pt;">root@rk3572-buildroot</span><span style="font-size: 10.5pt;">:/# ifconfig</span></font>
2.1.2 eth0获取ip地址 将网线插入丝印为GMAC0的网口中,评估板已配置为以太网插入网口自动获取 IP 地址,若已成功分配地址,可跳过本步骤。 如需手动获取 IP 地址,可执行以下命令: - <font color="#000000" face="宋体"><span style="font-size: 10.5pt;">root@rk3572-buildroot</span><span style="font-size: 10.5pt;">:/# udhcpc -i eth0</span></font>
2.1.3 测试eth0网络连接 - <font face="宋体"><span style="color: rgb(0, 0, 0); font-size: 10.5pt;">root@rk3572-buildroot</span><span style="font-size: 10.5pt;"><font color="#000000">:/# ping </font></span><a href="http://www.baidu.com/" style=""><span style="font-size: 10.5pt;"><font color="#000000">www.baidu.com</font></span></a><span style="font-size: 10.5pt;"><font color="#000000"> -I eth0 -</font></span><span style="color: rgb(0, 0, 0); font-size: 10.5pt;">c</span><span style="color: rgb(0, 0, 0); font-size: 10.5pt;"> 5</span></font>
2.1.4 eth0 iperf3测试 如需进行千兆网络测试,请确保所使用的网线均支持千兆传输, Ubuntu系统已连接至千兆网络,此处Ubuntu的ip为192.168.0.109,Ubuntu作为服务端时,执行以下命令启动iperf服务: - <font color="#000000" face="宋体">talowe@ubuntu:~/Desktop$ iperf3 -s</font>
底板作为客户端中执行,IP地址为客户端Ubuntu的地址,确保底板与Ubuntu在同一网段: - <font color="#000000" face="宋体"><span style="font-size: 10.5pt;">root@rk3572-buildroot</span><span style="font-size: 10.5pt;">:/# iperf3 -c 192.168.0.1</span><span style="font-size: 10.5pt;">09</span><span style="font-size: 10.5pt;"> -t 5</span></font>
2.1.5 eth1获取ip地址 将网线插入丝印为GMAC1的网口中,评估板已配置为以太网插入网口自动获取 IP 地址,若已成功分配地址,可跳过本步骤。 如需手动获取 IP 地址,可执行以下命令: - <font color="#000000" face="宋体"><span style="font-size: 10.5pt;">root@rk3572-buildroot</span><span style="font-size: 10.5pt;">:/# </span><span style="font-size: 10.5pt;">udhcp</span><span style="font-size: 10.5pt;">c -i eth</span><span style="font-size: 10.5pt;">1</span></font>
2.1.6 测试eth1网络连接 - <font color="#000000" face="宋体"><span style="font-size: 10.5pt;">root@rk3572-buildroot</span><span style="font-size: 10.5pt;">:/# ping </span><a href="http://www.baidu.com/"><span style="font-size: 10.5pt;">www.baidu.com</span></a><span style="font-size: 10.5pt;"> -I eth</span><span style="font-size: 10.5pt;">1</span><span style="font-size: 10.5pt;"> -</span><span style="font-size: 10.5pt;">c</span><span style="font-size: 10.5pt;"> 5</span></font>
2.1.7 eth1 iperf3测试 如需进行千兆网络测试,请确保所使用的网线均支持千兆传输, Ubuntu系统已连接至千兆网络,此处Ubuntu的ip为192.168.0.109,Ubuntu作为服务端时,执行以下命令启动iperf服务: - <font color="#000000" face="宋体">talowe@ubuntu:~/Desktop$ iperf3 -s</font>
底板作为客户端中执行,IP地址为客户端Ubuntu的地址,确保底板与Ubuntu在同一网段: - <font color="#000000" face="宋体"><span style="font-size: 10.5pt;">root@rk3572-buildroot</span><span style="font-size: 10.5pt;">:/# iperf3 -c 192.168.0.1</span><span style="font-size: 10.5pt;">09</span><span style="font-size: 10.5pt;"> -t 5</span></font>
2.2 WIFI测试 Pi-RK3572底板上板载一路SDIO Wi-Fi接口,采用AP6256模块,支持Wi-Fi和蓝牙功能。在底板上Wi-Fi接口的丝印标识为U6。在进行wifi测试之前,先将wifi模块插上天线,以免连接不上。 2.2.1 WIFI测试(STA模式) 查看网络节点 - <font color="#000000" face="宋体"><span style="font-size: 10.5pt;">root@rk3572-buildroot</span><span style="font-size: 10.5pt;">:/# i</span><span style="font-size: 10.5pt;">f</span><span style="font-size: 10.5pt;">config </span><span style="font-size: 10.5pt;">w</span><span style="font-size: 10.5pt;">lan0</span></font>
连接wifi 输入如下命令连接wifi:wifi-connect.sh+ssid+密码 - <font color="#000000" face="宋体"><span style="font-size: 10.5pt;">root@rk3572-buildroot</span><span style="font-size: 10.5pt;">:/# wifi-connect.sh Talowe-5G-0 Talowe888</span></font>
获取ip地址 - <font color="#000000" face="宋体"><span style="font-size: 10.5pt;">root@rk3572-buildroot</span><span style="font-size: 10.5pt;">:/# udhcpc -</span><span style="font-size: 10.5pt;">i</span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;">w</span><span style="font-size: 10.5pt;">lan0</span></font>
测试网络连接 - <font color="#000000" face="宋体"><span style="font-size: 10.5pt;">root@rk3572-buildroot</span><span style="font-size: 10.5pt;">:/# </span><span style="font-size: 10.5pt;">ping</span><span style="font-size: 10.5pt;"> </span><a href="http://www.baidu.com/"><span style="font-size: 10.5pt;">www.baidu.com</span></a><span style="font-size: 10.5pt;"> -I wlan0 -c 5</span></font>
iperf3测试 Ubuntu作为服务端时,此处Ubuntu的ip为192.168.0.109,执行以下命令启动iperf服务: - <font color="#000000" face="宋体"><span style="font-size: 10.5pt;">root@rk3572-buildroot</span><span style="font-size: 10.5pt;">:/# iperf3 -s</span></font>
底板作为客户端中执行,IP地址为客户端Ubuntu的地址,确保底板与Ubuntu在同一网段: - <font color="#000000" face="宋体"><span style="font-size: 10.5pt;">root@rk3572-buildroot</span><span style="font-size: 10.5pt;">:/# iperf3 -c 192.168.0.1</span><span style="font-size: 10.5pt;">09</span><span style="font-size: 10.5pt;"> -t 5</span></font>
2.2.2 WIFI测试(AP模式) 配置wifi ip地址- <font color="#000000" face="宋体">root@rk3572-buildroot:/# ifconfig wlan0 192.168.2.1</font>
配置无线热点默认账号:talowe_rk3572密码:12345678,通过修改/etc/hostapd.conf文件来修改wifi账号密码。 - <font color="#000000" face="宋体"><span style="font-size: 10.5pt;">root@rk3572-buildroot</span><span style="font-size: 10.5pt;">:/# </span><span style="font-size: 10.5pt;">hostapd /etc/hostapd.conf &</span></font>
重启dnsmasq服务- <font color="#000000" face="宋体"><span style="font-size: 10.5pt;">root@rk3572-buildroot</span><span style="font-size: 10.5pt;">:/# </span><span style="font-size: 10.5pt;">killall dnsmasq</span></font>
设置NAT规则- <font color="#000000" face="宋体"><span style="font-size: 10.5pt;">root@rk3572-buildroot</span><span style="font-size: 10.5pt;">:/# </span><span style="font-size: 10.5pt;">iptables -t nat -A POSTROUTING -s 192.168.2.1/24 -o eth0 -j MASQUERADE</span></font>
启动ipv4转发- <font color="#000000" face="宋体"><span style="font-size: 10.5pt;">root@rk3572-buildroot</span><span style="font-size: 10.5pt;">:/# </span><span style="font-size: 10.5pt;">echo 1 > /proc/sys/net/ipv4/ip_forward</span></font>
完成以上Wi-Fi的AP模式设置后,打开手机的Wi-Fi列表,将看到名为talowe_RK3572的热点,可以进行连接,如图4-23所示,可以进行上网,这里通过eth0进行转发,请确保eth0 的连通性。 2.3蓝牙测试Pi-RK3572评估版使用的是WIFI/BT二合一模块,具体模块说明参考wifi测试章节,蓝牙的测试过程如下。查看蓝牙节点 - <font color="#000000" face="宋体">root@rk3572-buildroot:/# hciconfig</font>
开启蓝牙守护进程 - <p class="MsoNormal" style="margin-left:0.0000pt;mso-para-margin-left:0.0000gd;"><font color="#000000" face="宋体"><span style="font-size: 10.5pt;">root@rk3572-buildroot:/# killall bluetoothd</span><span style="font-size: 10.5pt;"><o:p></o:p></span></font></p><p class="MsoNormal" style="margin-left:0.0000pt;mso-para-margin-left:0.0000gd;"><font color="#000000" face="宋体"><span style="font-size: 10.5pt;">root@rk3572-buildroot:/# /usr/libexec/bluetooth/bluetoothd -C -E -n &</span><span style="font-size: 10.5pt;"><o:p></o:p></span></font></p><p class="MsoNormal" style="margin-left:0.0000pt;mso-para-margin-left:0.0000gd;"><font color="#000000" face="宋体"><span style="font-size: 10.5pt;">root@rk3572-buildroot:/# export $(dbus-launch)</span><span style="font-size: 10.5pt;"><o:p></o:p></span></font></p><p class="MsoNormal" style="margin-left:0.0000pt;mso-para-margin-left:0.0000gd;"><span style="font-size: 10.5pt;"><font color="#000000" face="宋体">root@rk3572-buildroot:/# /usr/libexec/bluetooth/obexd -r / -a -n &</font></span></p>
蓝牙连接配对 - <p class="MsoNormal" style="margin-left:0.0000pt;mso-para-margin-left:0.0000gd;"><font color="#000000" face="宋体"><span style="font-size: 10.5pt;">root@rk3572-buildroot:/# bluetoothctl</span><span style="font-size: 10.5pt;"><o:p></o:p></span></font></p><p class="MsoNormal" style="margin-left:0.0000pt;mso-para-margin-left:0.0000gd;"><font color="#000000" face="宋体"><span style="font-size: 10.5pt;">[bluetooth]# power on</span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;">#上电</span><span style="font-size: 10.5pt;"><o:p></o:p></span></font></p><p class="MsoNormal" style="margin-left:0.0000pt;mso-para-margin-left:0.0000gd;"><font color="#000000" face="宋体"><span style="font-size: 10.5pt;">[bluetooth]# agent on</span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;">#打开代理</span><span style="font-size: 10.5pt;"><o:p></o:p></span></font></p><p class="MsoNormal" style="margin-left:0.0000pt;mso-para-margin-left:0.0000gd;"><a name="OLE_LINK11"><font color="#000000" face="宋体"><span style="font-size: 10.5pt;">[bluetooth]# default-agent</span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;">#默认代理</span><span style="font-size: 10.5pt;"><o:p></o:p></span></font></a></p><p class="MsoNormal" style="margin-left:0.0000pt;mso-para-margin-left:0.0000gd;"><a name="OLE_LINK11"><font color="#000000" face="宋体"><span style="font-size: 10.5pt;">[bluetooth]# discoverable on</span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;">#可被发现</span><span style="font-size: 10.5pt;"><o:p></o:p></span></font></a></p><p class="MsoNormal" style="margin-left:0.0000pt;mso-para-margin-left:0.0000gd;"><a name="OLE_LINK11"><font color="#000000" face="宋体"><span style="font-size: 10.5pt;">[bluetooth]# scan on</span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;">#扫描设备</span></font></a></p>
扫描到需要连接的设备即可停止扫描,这里以安卓手机为例进行测试。 - <font color="#000000" face="宋体"><span style="font-size: 10.5pt;">[bluetooth]# scan off</span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;">#停止扫描</span></font>
查看设备MAC地址 - <font color="#000000" face="宋体"><span style="font-size: 10.5pt;">[bluetooth]# devices</span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;"> </span><span style="font-size: 10.5pt;">#查看扫描到的设备</span></font>
- <font color="#000000" face="宋体">[bluetooth]# pair FC:AB:D0:66:93:8C</font>
执行完上述指令后,需要根据后续设置PIN码。 此时手机已成功配对到底板蓝牙。 评估板接收文件 通过手机蓝牙发送文件到评估板。 评估板发送文件 - <p class="MsoNormal" style="margin-left:0.0000pt;mso-para-margin-left:0.0000gd;"><font color="#000000" face="宋体"><span style="font-size: 10.5pt;">root@rk3572-buildroot:/# obexctl</span><span style="font-size: 10.5pt;"><o:p></o:p></span></font></p><p class="MsoNormal" style="margin-left:0.0000pt;mso-para-margin-left:0.0000gd;"><span style="font-size: 10.5pt;"><font color="#000000" face="宋体">[obex]# connect E4:AA:E4:58:A5:4A</font></span></p>
- <font color="#000000" face="宋体">[E4:AA:E4:58:A5:4A]# send /11.txt</font>
此时手机会弹出是否接受文件,点击接收。 2.44G测试 EXPORT-PI扩展板上板载一路 4G接口,以MiniPCIe的方式引出,在扩展板上的丝印标识为U4,丝印标识为U11为SIM卡槽。 在系统启动之前接入4G模块如图5-14所示,型号为EC20,注意需要在4G模块上插上天线,并插入SIM卡,启动开发板。 2.4.1查看usb节点 - <font color="#000000" face="宋体"><span style="font-size: 10.5pt;">root@rk357</span><span style="font-size: 10.5pt;">2</span><span style="font-size: 10.5pt;">-buildroot:/# </span><span style="font-size: 10.5pt;">lsusb</span></font>
- <font color="#000000" face="宋体"><span style="font-size: 10.5pt;">root@rk357</span><span style="font-size: 10.5pt;">2</span><span style="font-size: 10.5pt;">-buildroot:/# </span><span style="font-size: 10.5pt;">ls /dev/ttyUSB*</span></font>
2.4.2拨号测试 - <font color="#000000" face="宋体"><span style="font-size: 10.5pt;">root@rk357</span><span style="font-size: 10.5pt;">2</span><span style="font-size: 10.5pt;">-buildroot:/#</span><span style="font-size: 10.5pt;"> quectelCM &</span></font>
(注:信号不稳定时拨号测试需要等待一段时间才可以成功) 2.4.3网络连接测试 - <font color="#000000" face="宋体"><span style="font-size: 10.5pt;">root@rk357</span><span style="font-size: 10.5pt;">2</span><span style="font-size: 10.5pt;">-buildroot:/# </span><span style="font-size: 10.5pt;">ping </span><a href="http://www.baidu.com/"><u><span class="15" style="font-size: 10.5pt;">www.baidu.com</span></u></a><span style="font-size: 10.5pt;"> -I wwan0 -c 5</span></font>
如果出现无法解析域名,执行以下指令即可: - <font color="#000000" face="宋体"><span style="font-size: 10.5pt;">root@rk357</span><span style="font-size: 10.5pt;">2</span><span style="font-size: 10.5pt;">-buildroot:/# </span><span style="font-size: 10.5pt;">echo "nameserver 114.114.114.114" >> /etc/resolv.conf</span></font>
三、结语 对嵌入式/边缘计算设备来说,工程上的常见形态是多网冗余/互补,以太网为主、4G备份链路、WiFi做本地维护通道——这也是工业板卡普遍三网齐配的原因。 这是工业IOT、边缘智能成立的前提。无论您正在规划边缘AI设备、工业控制还是消费电子项目,PI-RK3572都值得纳入方案评估——它或许能为您的下一个产品提供助力。目前眺望电子 Pi-RK3572工业派已正式开售,若需要完整开发资料或套件样机,可以在公众号后台留言,或者向眺望电子技术支持工程师联系获取! 下期预告:【开箱指南】眺望Pi-RK3572工业派通信性能实测
|