4003 NEO3 CAT1 EN:修订间差异

来自Mcuzone Wiki
第84行: 第84行:
http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_55.jpg
http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_55.jpg


Save and exit. At this point, pinging the domain name succeed:
Save and exit. At this point, pinging the domain name and pinging the IP address both succeed:


http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_56.jpg
http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_56.jpg
第136行: 第136行:


=== 3.2 Ubuntu focal ===
=== 3.2 Ubuntu focal ===
测试使用的友善官方烧写包版本:rk3328-sd-friendlycore-focal-4.19-arm64-20240818.img.gz
The version of the FriendlyElec system we tested: rk3328-sd-friendlycore-focal-4.19-arm64-20240818.img.gz


==== 3.2.1 通过TTL串口连接电脑操作 ====
==== 3.2.1 Operate through TTL serial connection to PC ====
通过USB转TTL模块,将NEO3连接到PC,打开MobaXterm,设置好TTL串口:
Connect the NEO3 to a computer using a USB-to-TTL module. Open MobaXterm and configure the TTL serial port as shown in the figure below:


'''''注意:波特率使用1500000'''''
'''''Note: Use a baud rate of 1500000.'''''


http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_84.jpg
http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_84.jpg


然后打开这个串口,登录Ubuntu系统(用户名和密码都是<code>pi</code>)。
Then open this serial port and log in to the Ubuntu system (username: <code>pi</code>, password: <code>pi</code>):


执行<code>ifconfig -a</code>,查看网络参数如下:
Excecute <code>ifconfig -a</code> to view the following network parameters:


http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_79.jpg
http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_79.jpg


系统自动识别4G为eth1,但不能直接获取ip地址,说明系统没有开启4G,需要配置,配置方法如下:
The system automatically recognizes the 4G interface as eth1, but it cannot obtain an IP address directly, indicating that the 4G functionality is not enabled. Configuration is required. The configuration method is as follows:


安装DNS切换软件udhcpc,用网线将NEO3连接到上级路由器,使之可以上网,安装udhcpc:
Connect the NEO3 to the upstream router with an Ethernet cable to enable internet access, and install the DNS switching software udhcpc:


<code>sudo apt-get update</code>
<code>sudo apt-get update</code>
第159行: 第159行:
<code>sudo apt install udhcpc</code>
<code>sudo apt install udhcpc</code>


安装完毕后,拔掉NEO3的网线,执行下列命令:
After installation, unplug the network cable from the NEO3 and execute the following commands:


<code>sudo udhcpc -i eth1</code>
<code>sudo udhcpc -i eth1</code>
第165行: 第165行:
http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_80.jpg
http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_80.jpg


执行完毕后,在执行<code>ifconfig -a</code>,查看网络参数如下:
After execution, run <code>ifconfig -a</code> again to view the network parameters as follows:


http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_81.jpg
http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_81.jpg


可见此时4G模组(eth1)已经获得了IP地址。
It can be seen that the 4G module has already obtained an IP address.


通过4G模组上网,ping外网地址结果如下:
The result of pinging a domain name through the 4G module is as follows:


http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_82.jpg
http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_82.jpg


以上设置仅为临时设置,系统重启后又会恢复到默认状态(除了udhcpc软件不会因为系统重启而消失),如果需要每次重启后都能直接启用4G上网,编辑启动项文件rc.local:
The above settings are temporary; after the system restarts, it will revert to its default state (although the udhcpc software will not be removed upon system reboot). If you need to enable 4G internet access directly after each reboot, edit the startup file rc.local:


<code>sudo vi /etc/rc.local</code>
<code>sudo vi /etc/rc.local</code>


在exit 0上面添加需要开机执行的命令:
Add the commands that need to be executed on startup above the "exit 0" line:


<code>sudo udhcpc -i eth1</code>
<code>sudo udhcpc -i eth1</code>
第185行: 第185行:
http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_83.jpg
http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_83.jpg


保存后退出,重启系统,启动后执行<code>ifconfig -a</code>,即可见4G模组(eth1)已经获取了ip地址。
After saving and exiting, restart the system. Upon startup, execute <code>ifconfig -a</code>, and you will see that the 4G module (eth1) has obtained an IP address.


'''注意''',以上是仅连接4G时的操作,如果NEO3的网口同时接入有线网络,那默认是优先使用有线网络上网,此时如果要使用4G上网的话,需要将执行的命令改为:
'''Note:''' The above steps are for the procedure when connecting only the 4G. If the NEO3's Ethernet port is connected to a wired network at the same time, the system will default to using the wired network for internet access. If you want to use the 4G connection for internet access instead, you need to change the command to:


<code>sudo udhcpc -i eth1 && sudo ip route del default && sudo route add -net default netmask 0.0.0.0 gw 192.168.10.1</code>
<code>sudo udhcpc -i eth1 && sudo ip route del default && sudo route add -net default netmask 0.0.0.0 gw 192.168.10.1</code>


这三条命令(以“&&”分隔)的解释:
Explanation of these three commands (separated by '&&'):


<code>sudo udhcpc -i eth1</code>:运行udhcpc,使4G模组获得ip地址;
<code>sudo udhcpc -i eth1</code>: Execute udhcpc to obtain an IP address for the 4G module.


<code>sudo ip route del default</code>:删除路由表中的默认路由;
<code>sudo ip route del default</code>: Remove the default route from the routing table.


<code>sudo route add -net default netmask 0.0.0.0 gw 192.168.10.1</code>:添加4G模组的网关为新的默认路由(网关地址以实际为准)。
<code>sudo route add -net default netmask 0.0.0.0 gw 192.168.10.1</code>: Add the gateway of the 4G module network as a new default route (ensure to use the actual gateway address).


执行完毕后,再执行<code>route</code>,查看路由表,目前的默认路由为4G模组的网关:
After completing the execution, execute the <code>route</code> command to view the routing table. The current default route is the gateway of the 4G module network:


http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_87.jpg
http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_87.jpg


可正常ping通域名:
It is able to successfully ping the domain:


http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_67.jpg
http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_67.jpg


如果需要每次重启后都能直接启用4G上网,则需把rc.local里面添加的命令改成上面这条。
If you need to enable 4G internet access directly after each reboot, you should modify the command added in rc.local to the one mentioned above.


==== 3.2.2 通过网线SSH连接电脑操作 ====
==== 3.2.2 Operate through SSH over Ethernet ====
用网线将NanoPi NEO3网口接无线路由器,然后PC通过无线网络连接同一个无线路由器,插入SIM卡。系统启动后,通过路由器的后台,查看NanoPi NEO3的ip地址:
Connect NanoPi NEO3's Ethernet port to the upstream router using an Ethernet cable, then connect the PC to the same upstream router. Insert the SIM card and the TF card with the system. After the system starts, check NanoPi NEO3's IP address through the router's backend:


http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_61.jpg
http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_61.jpg


然后使用MobaXterm,通过SSH连接系统(用户名和密码都是<code>pi</code>):
Then use MobaXterm to connect to the system via SSH (username: <code>pi</code>, password: <code>pi</code>):


http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_62.jpg
http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_62.jpg


其余测试步骤与使用TTL连接相同。
The remaining test steps are the same as when using a TTL connection.


== '''四、Debian系统的操作''' ==
== '''IV. Work with Debian OS''' ==
测试使用的友善官方烧写包版本:rk3328-sd-debian-bookworm-core-6.1-arm64-20241112.img.gz
The version of the FriendlyElec system we tested: rk3328-sd-debian-bookworm-core-6.1-arm64-20241112.img.gz


使用方法和Ubuntu一致,也是两种:一种是通过USB转TTL串口模块将NEO3接到电脑上('''''注意:波特率使用1500000''''');一种是通过NEO3的网口接到无线路由器,PC也接到此无线路由器,通过SSH操作。在此不再重复。
Consistent with the Ubuntu system, there are two methods for operation: one is to connect to a computer via a USB-to-TTL serial module ('''''Note: Use a baud rate of 1500000.'''''), and the other is to connect to a router using the Ethernet port and access it through SSH. This will not be repeated here.


打开MobaXterm,通过TTL串口登录Debian系统(用户名和密码都是<code>pi</code>)。
Open MobaXterm and log in to the Debian system via the TTL serial port(username: <code>pi</code>, password: <code>pi</code>).


=== 4.1 4G模组操作 ===
=== 4.1 4G module operations ===
本系统不支持<code>ifconfig</code>命令,因此我们使用<code>ip addr</code>命令代替:
This system does not support the <code>ifconfig</code>, so we use the <code>ip addr</code> as an alternative:


http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_91.jpg
http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_91.jpg


测试用的内网的IP是192.168.8.x这样的格式,因此 2(eth0)为千兆网卡,所以3(eth1)为4G CAT1,4G模组开机即正确获取了IP。
The IP addresses for the internal network used in testing follow the format 192.168.8.x. Therefore, interface 2 (eth0) is the Gigabit Ethernet card, while interface 3 (eth1) is the 4G CAT1 module, which correctly obtained an IP address upon startup.


我们拔掉网线,此时只有4G模组连接网络,ping外网IP地址,可以ping通,说明可以通过4G网络连接Internet;
We unplugged the Ethernet cable, leaving only the 4G module connected to the network. By pinging an external IP address, we found that it was reachable, indicating that Internet connectivity is possible through the 4G network.


http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_92.jpg
http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_92.jpg


但是ping域名报错,说明友善系统没有启用4G,我们需要修改DNS设置,操作如下:
However, if pinging a domain name results in an error, it indicates that we need to modify the system's DNS settings. The procedure is as follows:


修改resolv.conf文件:
Edit the resolv.conf file:


<code>sudo nano /etc/resolv.conf</code>
<code>sudo nano /etc/resolv.conf</code>


添加常用的DNS服务器地址(如所示的114.114.114.114):
Add a general DNS server address (such as 114.114.114.114, or any other general DNS address):


<code>nameserver 114.114.114.114</code>
<code>nameserver 114.114.114.114</code>
第250行: 第250行:
http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_93.jpg
http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_93.jpg


保存退出后即可正常ping通域名:
Save and exit. At this point, pinging the domain name succeed:


http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_94.jpg
http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_94.jpg


但是单单这么修改的话,重启后resolv.conf文件内的DNS会被修改到默认地址,所以还需要修改resolv.conf文件的权限,因为/etc/resolv.conf实际上是个软链接,所以需要重新生成resolv.conf文件才能修改权限,方法如下:
但是单单这么修改的话,重启后resolv.conf文件内的DNS会被修改到默认地址,所以还需要修改resolv.conf文件的权限,因为/etc/resolv.conf实际上是个软链接,所以需要重新生成resolv.conf文件才能修改权限,方法如下:
However, after making these changes, if the system restarts, the DNS entries in the resolv.conf file will be reset to their default addresses. So you will also need to modify the permissions of the resolv.conf file. Since /etc/resolv.conf is actually a symbolic link, you need to regenerate the resolv.conf file in order to modify its permissions. The method to do so is as follows:


<code>sudo mv /etc/resolv.conf /etc/resolv.conf.link</code>
<code>sudo mv /etc/resolv.conf /etc/resolv.conf.link</code>
第260行: 第262行:
<code>sudo nano /etc/resolv.conf</code>
<code>sudo nano /etc/resolv.conf</code>


这样就重新建立了resolv.conf文件,在这个新建的文件中输入:
This recreates the resolv.conf file. In this newly created file, enter the following:


<code>nameserver 114.114.114.114</code>
<code>nameserver 114.114.114.114</code>


保存退出,然后执行:
Save and exit, then execute:


<code>sudo chattr +i /etc/resolv.conf</code>
<code>sudo chattr +i /etc/resolv.conf</code>


做完上述步骤后,重启系统,resolv.conf文件的内容也不会变化了。
After completing the above steps, restart the system, and the contents of the resolv.conf file will remain unchanged.


=== 4.2 网络优先级的修改 ===
=== 4.2 Modification of network priority ===
NEO3插4G的同时,网口接网线,那网络怎么使用?这里需要考虑到网络的优先级,操作如下:
If the NEO3 is inserted with a 4G module and simultaneously connected to a network cable through its Ethernet port, which network will it use by default? At this point, it's necessary to consider the network priority. The operations are as follows:


执行<code>ip route</code>,结果如下:
Execute the command <code>ip route</code>, and the result is as follows:


http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_98.jpg
http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_98.jpg


可见eth1(4G CAT1)的metric值为100,eth0(千兆网卡)的metric值为101,eth1的metric值比eth0的小,所以网络默认走4G。
It can be seen, the metric value for eth1 (4G CAT1) is 100, while the metric value for eth0 (Gigabit Ethernet card) is 101. Since the metric value of eth1 is lower than that of eth0, the network defaults to using the 4G connection.


如果需要使网络默认走千兆网卡的话,需要安装ifmetric软件:
If you need to set the network to default through the Gigabit Ethernet card, you will need to install the ifmetric software:


<code>sudo apt install ifmetric</code>
<code>sudo apt install ifmetric</code>


安装完毕后就可以修改网卡的metric值,比如将eth1的metric值修改为102,可执行:
After installation, you can modify the metric value of the network interface. For example, to change the metric value of eth1 to 102, you can execute the following command:


<code>sudo ifmetric eth1 102</code>
<code>sudo ifmetric eth1 102</code>


修改完毕后再用<code>ip route</code>命令查看,我们可以看到eth1的metric值已修改为102:
After making the changes, use the <code>ip route</code> command to check, and we can see that the metric value for eth1 has been changed to 102:


http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_99.jpg
http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_99.jpg


这样eth0的metric值比eth1的小,所以网络默认走千兆网卡。
The metric value for eth0 is lower than that of eth1 now, so the network defaults to using the Gigabit Ethernet card.


'''''注意,如果系统重启,4G的优先级还是会比有线网络高,所以如果要开机默认走有线网络,需要再执行一次<code>sudo ifmetric eth1 102</code>,(不需要重新安装ifmetric软件)。'''''
'''''Note: If the system restarts, the 4G connection's priority will still be higher than that of the wired network. Therefore, to ensure that the system defaults to using the wired network connection upon startup, you need to run the command <code>sudo ifmetric eth1 102</code> again (there is no need to reinstall the ifmetric software).'''''


== '''五、4G的AT命令使用''' ==
== '''V. AT command operation''' ==
不管用哪个操作系统,4G的AT命令使用方法都是一样的。
Regardless of which operating system is used, the method for using 4G AT commands remains the same.


=== 5.1 开启AT命令操作 ===
=== 5.1 Enable AT command operations ===
如果无法执行<code>lsusb</code>,请先安装usbutils:
If you are unable to execute <code>lsusb</code>, please install usbutils first:


<code>sudo apt install usbutils</code>
<code>sudo apt install usbutils</code>


使用<code>lsusb</code>查看USB设备,红框处即为4G模组:
Use <code>lsusb</code> to view USB devices, the red-boxed entry indicates the 4G module:


http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_95.jpg
http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_95.jpg


记下4G模块的ID值:19d1 0001
Note down the ID value of the 4G module: 19d1 0001


使用下列命令开启4G模组的ttyACM串口,其中echo后面的值就是上面记录的ID值:
Use the following command to enable the ttyACM serial port of the 4G module, where the value after <code>echo</code> is the ID value recorded earlier:


<code>sudo modprobe option</code>
<code>sudo modprobe option</code>
第316行: 第318行:


执行以上两条命令后系统应该会多出ttyACM0-2三个设备,输入<code>ls /dev</code>可以查看:
执行以上两条命令后系统应该会多出ttyACM0-2三个设备,输入<code>ls /dev</code>可以查看:
After executing the above two commands, the system should have three additional devices: ttyACM0, ttyACM1, and ttyACM2. You can check this by entering <code>ls /dev</code>:


http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_96.jpg
http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_96.jpg


然后用串口工具打开特定串口(AT命令串口):
Then, use a serial port tool to open the specific serial port (AT command serial port):


安装minicom工具:
Install the serial port software <code>minicom</code>:


<code>sudo apt-get install minicom</code>
<code>sudo apt-get install minicom</code>


通过minicom打开AT命令串口:
Open the AT command serial port using minicom:


<code>sudo minicom -D /dev/ttyACM0</code>
<code>sudo minicom -D /dev/ttyACM0</code>


(注意:使用哪个串口,应以在进入此串口后,可输入运行AT命令,显示不乱码,不乱跳结果为准)
(Note: Which serial port to use should be determined by the ability to enter and execute AT commands without garbled or erratic output after accessing that serial port.)


如果需要查看回显,请键入命令:<code>ate1</code>,然后回车,继续键入其它命令,回车可以看到结果。
If you need to view echo responses, type the command: <code>ATE1</code>, then press Enter. You can continue to type other commands, and after pressing Enter, you will see the results.


http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_97.jpg
http://www.mcuzone.com/wiki/4003_FriendlyElec_NanoPi_NEO3/4003_FriendlyElec_NanoPi_NEO3_97.jpg


常用AT命令:
Common AT commands:


1. 检查SIM卡是否识别到:
1) Check if the SIM card is detected:


<code>at+cpin?</code>
<code>at+cpin?</code>


返回ready表示卡已识别,返回error要检查硬件
Return ready to indicate the card has been recognized, if return error, you need to check the hardware.


2. 检查天线信号质量:
2) Check antenna signal quality:


<code>at+csq</code>
<code>at+csq</code>


返回值在26-31表示信号OK,信号满格31;返回值在20-25表示信号勉勉强强;返回值在20以下表示信号比较糟糕或者天线没接
eturn values between 26 and 31 indicate a good signal, with 31 representing a full signal strength; return values between 20 and 25 indicate a barely acceptable signal; return values below 20 indicate a poor signal or that the antenna might not be connected.


3. 检查注网情况:
3) Check network registration status:


<code>at+cops?</code>
<code>at+cops?</code>


正常应该返回运营商代码和7,7代表4G。
Normally, it should return the network supporter's code: 7, where 7 represents 4G.


注意,以上命令只有<code>at+csq</code>不要加问号,另外两条命令需要加问号。
Note: The above command <code>at+csq</code> should not include a question mark, while the other two commands require a question mark.


4. 查看4G模块的IMEI码:
4) View the SIM card's IMEI code:


<code>at+cgsn</code>
<code>at+cgsn</code>


5. 重启4G模块(有时候如果重插SIM卡,热插拔不一定管用,可以用这个reset命令来复位模块):
5) Reset 4G module (Sometimes, if you reinsert the SIM card, hot swapping may not work; in such cases, you can use this reset command to reset the module.):


<code>at+reset</code>
<code>at+reset</code>


6. 关闭射频:
6) Disable radio frequency:


<code>at+cfun=0</code>
<code>at+cfun=0</code>


开启射频:
Enable radio frequency:


<code>at+cfun=1</code>
<code>at+cfun=1</code>


上述两条命令成对使用,可以在不重启4G模组的情况下让模组重新注网。
The two commands mentioned above can be used in pairs to allow the module to re-register with the network without restarting the 4G module.


=== 5.2 修改4G模组的IP地址 ===
=== 5.2 Modify the IP address of the 4G module ===
执行AT命令:
Execute the AT command:


<code>AT+ROUTEIP=<newip></code>
<code>AT+ROUTEIP=<newip></code>


注意,只支持192.168.x.2这样格式的地址,设置完毕后需断电重启系统。
Note: Only addresses in the format of 192.168.x.2 are supported. After completing the settings, you need to power off and restart the system.


查询当前IP:<code>AT+ROUTEIP?</code>
Check the current IP: <code>AT+ROUTEIP?</code>


测试IP是否生效:<code>AT+ROUTEIP=?</code>
Verify whether the IP address is active: <code>AT+ROUTEIP=?</code>


== '''六、总结''' ==
== '''VII. Summary''' ==
此介绍仅限于CAT1基于NEO3的使用操作,不包括NanoPi NEO3开发板自身的使用及软件;因此,如需NEO3开发板的使用操作,以及相关系统镜像的下载,请到友善官网查阅:
We only introduce the usage and operations for CAT1 based on NEO3, without covering the operations and software system specific to the NanoPi development board itself. For information about the NanoPi NEO3 boards, please visit the FriendlyElec official website:


https://wiki.friendlyelec.com/wiki/index.php/NanoPi_NEO3/zh
https://wiki.friendlyelec.com/wiki/index.php/NanoPi_NEO3/zh


{{联系我们_图标}}
{{联系我们_图标}}

2024年12月11日 (三) 15:29的版本

切换语言为中文

Keywords

FriendlyElec NanoPi NEO3, CAT1 4G LTE, RK3328, Debian, Ubuntu, IoT

I. Introduction

The NEO3 CAT1 is a 4G LTE product that we have designed based on the FriendlyElec NanoPi NEO3 development board. The 4G module is a USB device that uses the USB IO pins of the NEO3 development board for communication and power supply, thereby providing 4G network connectivity to the NEO3 development board.

4G Cat1 is a high-cost-performance module aimed at low-speed IoT applications with speeds around 10Mbps. The rates of 10Mbps downlink and 5Mbps uplink can meet the majority of connectivity and transmission requirements. On FriendlyElec's Ubuntu and Debian systems, the 4G module is automatically recognized, requiring no additional driver installation.

The NEO3 is equipped with a Gigabit Ethernet port and a USB 3.0 interface. When paired with the NEO3 development board, the NEO3 CAT1 can function as a high-performance IoT device.

II. Hardware Spec

1. One USB 2.0 port, used for powering and communication with the 4G module. The module comes in two packaging options: one is a female header connector, designed for connecting to the NEO3 development board. The other is a 1.25mm-4P interface, intended for connecting to other development boards that are not NEO3. You may choose to use one of the two packaging interfaces.

2. One USB-C port is the NEO3's own USB 2.0 port, which is derived from the NEO3's IO pins.

3. One 4G CAT1 LTE.

4. One IPEX Gen 1 antenna port.

5. One Nano SIM slot.

6. Three LEDs: STS, MODE, and NET.

7. Three M2.5 mounting holes.

8. Size: The maximum size is 51*52mm.

9. PCB board: 2-layer, with gold plating process, lead-free production; the material is UL and RoHS certified, with a fire rating of 94V-0.

4003_FriendlyElec_NanoPi_NEO3_106.jpg

4003_FriendlyElec_NanoPi_NEO3_111.jpg

4003_FriendlyElec_NanoPi_NEO3_108.jpg

4003_FriendlyElec_NanoPi_NEO3_109.jpg

III. Work with Ubuntu OS

3.1 Ubuntu Noble

The version of the FriendlyElec system we tested: rk3328-sd-ubuntu-noble-core-6.1-arm64-20240818.img.gz

There are two methods for operation: one is to connect to a computer via a USB-to-TTL serial module, and the other is to connect to a router using the Ethernet port and access it through SSH.

3.1.1 Operate through TTL serial connection to PC

Connect the NEO3 to a computer using a USB-to-TTL module (connect TXD to RXD, RXD to TXD, and GND to GND), as shown in the figure below:

4003_FriendlyElec_NanoPi_NEO3_110.jpg

Then download and install the terminal software MobaXterm on your PC. The download link for MobaXterm is:

https://mobaxterm.mobatek.net/download-home-edition.html

Open MobaXterm and configure the TTL serial port as shown in the figure below:

Note: Use a baud rate of 115200.

4006_FriendlyElec_NanoPi_NEO_CAT1_70.jpg

Then open this serial port and log in to the Ubuntu system (username: pi, password: pi):

4003_FriendlyElec_NanoPi_NEO3_75.jpg

Excecute ifconfig -a to view the following network parameters:

4003_FriendlyElec_NanoPi_NEO3_76.jpg

It can be seen that the 4G module is identified as eth1, and it has already obtained an IP address.

Pinging an IP address is successful, indicating that the 4G network can be used to connect to the Internet.

4003_FriendlyElec_NanoPi_NEO3_77.jpg

But pinging a domain name results in an error, indicating that the system needs to have its DNS addresses configured. The setup method is as follows:

Edit the resolv.conf file:

sudo vi /etc/resolv.conf

Change the address in the yellow box in the image below to a general DNS server address (such as 114.114.114.114, or any other general DNS address):

4003_FriendlyElec_NanoPi_NEO3_55.jpg

Save and exit. At this point, pinging the domain name and pinging the IP address both succeed:

4003_FriendlyElec_NanoPi_NEO3_56.jpg

However, after making these changes, if the system restarts, the DNS entries in the resolv.conf file will be reset to their default addresses. Therefore, if you need the 4G internet connection to start automatically upon boot, you will also need to modify the permissions of the resolv.conf file. Since /etc/resolv.conf is actually a symbolic link, you need to regenerate the resolv.conf file in order to modify its permissions. The method to do so is as follows:

sudo mv /etc/resolv.conf /etc/resolv.conf.link

sudo vi /etc/resolv.conf

This recreates the resolv.conf file. In this newly created file, enter the following:

nameserver 114.114.114.114

Save and exit, then execute:

sudo chattr +i /etc/resolv.conf

After completing the above steps, restart the system, and the contents of the resolv.conf file will remain unchanged.

★If the NEO3's Gigabit Ethernet port is connected to a wired network at the same time, it will still prioritize the 4G connection for internet access by default. If you want to prioritize the wired network connection for internet access, you need to run the following command:

sudo ip route del default && sudo route add -net default netmask 0.0.0.0 gw 192.168.8.1

Explanation of these two commands (separated by '&&'):

sudo ip route del default: Remove the default route from the routing table.

sudo route add -net default netmask 0.0.0.0 gw 192.168.8.1: Add the gateway of the wired or wireless network as a new default route (ensure to use the actual gateway address).

After completing the execution, execute the route command to view the routing table. The current default route is the gateway of the wired or wireless network:

4003_FriendlyElec_NanoPi_NEO3_101.jpg

Note: After a reboot, the routing table resets. To ensure the network continues to use the wired or wireless connection as the default route post-restart, you'll need to execute sudo ip route del default && sudo route add -net default netmask 0.0.0.0 gw 192.168.8.1 again.

3.1.2 Operate through SSH over Ethernet

Connect NanoPi NEO3's Ethernet port to the upstream router using an Ethernet cable, then connect the PC to the same upstream router. Insert the SIM card and the TF card with the system. After the system starts, check NanoPi NEO3's IP address through the router's backend:

4003_FriendlyElec_NanoPi_NEO3_51.jpg

Then use MobaXterm to connect to the system via SSH:

4003_FriendlyElec_NanoPi_NEO3_78.jpg

Then open this serial port and log in to the Ubuntu system (username: pi, password: pi):

4003_FriendlyElec_NanoPi_NEO3_52.jpg

The remaining test steps are the same as when using a TTL connection.

3.2 Ubuntu focal

The version of the FriendlyElec system we tested: rk3328-sd-friendlycore-focal-4.19-arm64-20240818.img.gz

3.2.1 Operate through TTL serial connection to PC

Connect the NEO3 to a computer using a USB-to-TTL module. Open MobaXterm and configure the TTL serial port as shown in the figure below:

Note: Use a baud rate of 1500000.

4003_FriendlyElec_NanoPi_NEO3_84.jpg

Then open this serial port and log in to the Ubuntu system (username: pi, password: pi):

Excecute ifconfig -a to view the following network parameters:

4003_FriendlyElec_NanoPi_NEO3_79.jpg

The system automatically recognizes the 4G interface as eth1, but it cannot obtain an IP address directly, indicating that the 4G functionality is not enabled. Configuration is required. The configuration method is as follows:

Connect the NEO3 to the upstream router with an Ethernet cable to enable internet access, and install the DNS switching software udhcpc:

sudo apt-get update

sudo apt install udhcpc

After installation, unplug the network cable from the NEO3 and execute the following commands:

sudo udhcpc -i eth1

4003_FriendlyElec_NanoPi_NEO3_80.jpg

After execution, run ifconfig -a again to view the network parameters as follows:

4003_FriendlyElec_NanoPi_NEO3_81.jpg

It can be seen that the 4G module has already obtained an IP address.

The result of pinging a domain name through the 4G module is as follows:

4003_FriendlyElec_NanoPi_NEO3_82.jpg

The above settings are temporary; after the system restarts, it will revert to its default state (although the udhcpc software will not be removed upon system reboot). If you need to enable 4G internet access directly after each reboot, edit the startup file rc.local:

sudo vi /etc/rc.local

Add the commands that need to be executed on startup above the "exit 0" line:

sudo udhcpc -i eth1

4003_FriendlyElec_NanoPi_NEO3_83.jpg

After saving and exiting, restart the system. Upon startup, execute ifconfig -a, and you will see that the 4G module (eth1) has obtained an IP address.

Note: The above steps are for the procedure when connecting only the 4G. If the NEO3's Ethernet port is connected to a wired network at the same time, the system will default to using the wired network for internet access. If you want to use the 4G connection for internet access instead, you need to change the command to:

sudo udhcpc -i eth1 && sudo ip route del default && sudo route add -net default netmask 0.0.0.0 gw 192.168.10.1

Explanation of these three commands (separated by '&&'):

sudo udhcpc -i eth1: Execute udhcpc to obtain an IP address for the 4G module.

sudo ip route del default: Remove the default route from the routing table.

sudo route add -net default netmask 0.0.0.0 gw 192.168.10.1: Add the gateway of the 4G module network as a new default route (ensure to use the actual gateway address).

After completing the execution, execute the route command to view the routing table. The current default route is the gateway of the 4G module network:

4003_FriendlyElec_NanoPi_NEO3_87.jpg

It is able to successfully ping the domain:

4003_FriendlyElec_NanoPi_NEO3_67.jpg

If you need to enable 4G internet access directly after each reboot, you should modify the command added in rc.local to the one mentioned above.

3.2.2 Operate through SSH over Ethernet

Connect NanoPi NEO3's Ethernet port to the upstream router using an Ethernet cable, then connect the PC to the same upstream router. Insert the SIM card and the TF card with the system. After the system starts, check NanoPi NEO3's IP address through the router's backend:

4003_FriendlyElec_NanoPi_NEO3_61.jpg

Then use MobaXterm to connect to the system via SSH (username: pi, password: pi):

4003_FriendlyElec_NanoPi_NEO3_62.jpg

The remaining test steps are the same as when using a TTL connection.

IV. Work with Debian OS

The version of the FriendlyElec system we tested: rk3328-sd-debian-bookworm-core-6.1-arm64-20241112.img.gz

Consistent with the Ubuntu system, there are two methods for operation: one is to connect to a computer via a USB-to-TTL serial module (Note: Use a baud rate of 1500000.), and the other is to connect to a router using the Ethernet port and access it through SSH. This will not be repeated here.

Open MobaXterm and log in to the Debian system via the TTL serial port(username: pi, password: pi).

4.1 4G module operations

This system does not support the ifconfig, so we use the ip addr as an alternative:

4003_FriendlyElec_NanoPi_NEO3_91.jpg

The IP addresses for the internal network used in testing follow the format 192.168.8.x. Therefore, interface 2 (eth0) is the Gigabit Ethernet card, while interface 3 (eth1) is the 4G CAT1 module, which correctly obtained an IP address upon startup.

We unplugged the Ethernet cable, leaving only the 4G module connected to the network. By pinging an external IP address, we found that it was reachable, indicating that Internet connectivity is possible through the 4G network.

4003_FriendlyElec_NanoPi_NEO3_92.jpg

However, if pinging a domain name results in an error, it indicates that we need to modify the system's DNS settings. The procedure is as follows:

Edit the resolv.conf file:

sudo nano /etc/resolv.conf

Add a general DNS server address (such as 114.114.114.114, or any other general DNS address):

nameserver 114.114.114.114

4003_FriendlyElec_NanoPi_NEO3_93.jpg

Save and exit. At this point, pinging the domain name succeed:

4003_FriendlyElec_NanoPi_NEO3_94.jpg

但是单单这么修改的话,重启后resolv.conf文件内的DNS会被修改到默认地址,所以还需要修改resolv.conf文件的权限,因为/etc/resolv.conf实际上是个软链接,所以需要重新生成resolv.conf文件才能修改权限,方法如下:

However, after making these changes, if the system restarts, the DNS entries in the resolv.conf file will be reset to their default addresses. So you will also need to modify the permissions of the resolv.conf file. Since /etc/resolv.conf is actually a symbolic link, you need to regenerate the resolv.conf file in order to modify its permissions. The method to do so is as follows:

sudo mv /etc/resolv.conf /etc/resolv.conf.link

sudo nano /etc/resolv.conf

This recreates the resolv.conf file. In this newly created file, enter the following:

nameserver 114.114.114.114

Save and exit, then execute:

sudo chattr +i /etc/resolv.conf

After completing the above steps, restart the system, and the contents of the resolv.conf file will remain unchanged.

4.2 Modification of network priority

If the NEO3 is inserted with a 4G module and simultaneously connected to a network cable through its Ethernet port, which network will it use by default? At this point, it's necessary to consider the network priority. The operations are as follows:

Execute the command ip route, and the result is as follows:

4003_FriendlyElec_NanoPi_NEO3_98.jpg

It can be seen, the metric value for eth1 (4G CAT1) is 100, while the metric value for eth0 (Gigabit Ethernet card) is 101. Since the metric value of eth1 is lower than that of eth0, the network defaults to using the 4G connection.

If you need to set the network to default through the Gigabit Ethernet card, you will need to install the ifmetric software:

sudo apt install ifmetric

After installation, you can modify the metric value of the network interface. For example, to change the metric value of eth1 to 102, you can execute the following command:

sudo ifmetric eth1 102

After making the changes, use the ip route command to check, and we can see that the metric value for eth1 has been changed to 102:

4003_FriendlyElec_NanoPi_NEO3_99.jpg

The metric value for eth0 is lower than that of eth1 now, so the network defaults to using the Gigabit Ethernet card.

Note: If the system restarts, the 4G connection's priority will still be higher than that of the wired network. Therefore, to ensure that the system defaults to using the wired network connection upon startup, you need to run the command sudo ifmetric eth1 102 again (there is no need to reinstall the ifmetric software).

V. AT command operation

Regardless of which operating system is used, the method for using 4G AT commands remains the same.

5.1 Enable AT command operations

If you are unable to execute lsusb, please install usbutils first:

sudo apt install usbutils

Use lsusb to view USB devices, the red-boxed entry indicates the 4G module:

4003_FriendlyElec_NanoPi_NEO3_95.jpg

Note down the ID value of the 4G module: 19d1 0001

Use the following command to enable the ttyACM serial port of the 4G module, where the value after echo is the ID value recorded earlier:

sudo modprobe option

sudo sh -c 'echo 19d1 0001 > /sys/bus/usb-serial/drivers/option1/new_id'

执行以上两条命令后系统应该会多出ttyACM0-2三个设备,输入ls /dev可以查看:

After executing the above two commands, the system should have three additional devices: ttyACM0, ttyACM1, and ttyACM2. You can check this by entering ls /dev:

4003_FriendlyElec_NanoPi_NEO3_96.jpg

Then, use a serial port tool to open the specific serial port (AT command serial port):

Install the serial port software minicom:

sudo apt-get install minicom

Open the AT command serial port using minicom:

sudo minicom -D /dev/ttyACM0

(Note: Which serial port to use should be determined by the ability to enter and execute AT commands without garbled or erratic output after accessing that serial port.)

If you need to view echo responses, type the command: ATE1, then press Enter. You can continue to type other commands, and after pressing Enter, you will see the results.

4003_FriendlyElec_NanoPi_NEO3_97.jpg

Common AT commands:

1) Check if the SIM card is detected:

at+cpin?

Return ready to indicate the card has been recognized, if return error, you need to check the hardware.

2) Check antenna signal quality:

at+csq

eturn values between 26 and 31 indicate a good signal, with 31 representing a full signal strength; return values between 20 and 25 indicate a barely acceptable signal; return values below 20 indicate a poor signal or that the antenna might not be connected.

3) Check network registration status:

at+cops?

Normally, it should return the network supporter's code: 7, where 7 represents 4G.

Note: The above command at+csq should not include a question mark, while the other two commands require a question mark.

4) View the SIM card's IMEI code:

at+cgsn

5) Reset 4G module (Sometimes, if you reinsert the SIM card, hot swapping may not work; in such cases, you can use this reset command to reset the module.):

at+reset

6) Disable radio frequency:

at+cfun=0

Enable radio frequency:

at+cfun=1

The two commands mentioned above can be used in pairs to allow the module to re-register with the network without restarting the 4G module.

5.2 Modify the IP address of the 4G module

Execute the AT command:

AT+ROUTEIP=<newip>

Note: Only addresses in the format of 192.168.x.2 are supported. After completing the settings, you need to power off and restart the system.

Check the current IP: AT+ROUTEIP?

Verify whether the IP address is active: AT+ROUTEIP=?

VII. Summary

We only introduce the usage and operations for CAT1 based on NEO3, without covering the operations and software system specific to the NanoPi development board itself. For information about the NanoPi NEO3 boards, please visit the FriendlyElec official website:

https://wiki.friendlyelec.com/wiki/index.php/NanoPi_NEO3/zh

联系我们

4f7e81daf8791971.jpg 79c020da7ad0af9b.jpg 2851e01a0549e6f7.gif 0003_bb.jpg 0005_qq.jpg QQ:8204136

邮件:mcuzone@vip.qq.com

电话:13957118045

如本页面有任何疏漏、错误或者侵权,请通过上述途径联系我们,谢谢!

Copyright 2004-2025 野芯科技