1006 RPi0 4G MiniPCIe(Expand 4G Module via MiniPCIe):修订间差异
第62行: | 第62行: | ||
Insert the TF card into the card reader after installation, plug the card reader into the PC's USB port, and then open the software. | Insert the TF card into the card reader after installation, plug the card reader into the PC's USB port, and then open the software. | ||
Raspberry Pi Device: Choose Raspberry Pi | Raspberry Pi Device: Choose Raspberry Pi Zero 2 W; | ||
Choose Use Custom, to flash the system image already downloaded onto the hard drive (no internet connection required). | Choose Use Custom, to flash the system image already downloaded onto the hard drive (no internet connection required). | ||
第76行: | 第76行: | ||
http://www.mcuzone.com/wiki/0005_MPS2242_2280/0005_MPS2242_2280_03.jpg | http://www.mcuzone.com/wiki/0005_MPS2242_2280/0005_MPS2242_2280_03.jpg | ||
''' | '''Note: It is recommended to select SSH, as it will be needed later:''' | ||
http://www.mcuzone.com/wiki/2005_CM4_NAS/2005_CM4_NAS_49.jpg | http://www.mcuzone.com/wiki/2005_CM4_NAS/2005_CM4_NAS_49.jpg | ||
If you need to use the pre-set settings, press "Yes"; if you do not need to use the pre-set settings, press "No". Proceed to the next page, and click "Yes" to start the flashing and verification process. After the flashing is complete, follow the prompts to remove the card. | |||
http://www.mcuzone.com/wiki/0005_MPS2242_2280/0005_MPS2242_2280_04.jpg | http://www.mcuzone.com/wiki/0005_MPS2242_2280/0005_MPS2242_2280_04.jpg |
2024年10月16日 (三) 11:39的版本
Keywords
Raspberry Pi, Raspberry Pi Zero, Cat1 4G LTE, USB2.0-A, Ethernet, Expansion Board, SSH
I. Introduction
The Zero series is compact and offers many expansion interfaces. The underside of the board features gold-plated test points for USB and power connections. These USB and power test points allow us to connect various types of peripherals for expansion. This expansion board is a USB hub, connecting the expansion board to the USB port of the Zero via pogo pins. It extends four USB ports through the USB connection: one USB port is converted to a 100Mbps wired Ethernet connection, one USB port is connected to a MiniPCIe 4G Cat1 module, and two USB2.0-A host interfaces are provided.
The 4G LTE module is a high-cost-performance module aimed at medium-speed IoT applications, capable of meeting the majority of connectivity and transmission needs. The 4G LTE module supports Qualcomm 4G/GPS, NL668-EU/EAU/AM, GoTone EG25-G.
II. Hardware Spec
2.1 Use gold-plated pogo pins to connect the Raspberry Pi Zero series, eliminating the need for external cables;
2.2 The two groups of gold-plated pogo pins are used separately for power supply and USB communication.
2.3 The expansion board is equipped with a USB-C power supply interface, which can power the entire system. The Micro USB port on the Zero can also be used for power.
2.4 The onboard USB hub expands the Zero's USB into four ports: one port is used for connecting a MiniPCIe 4G LTE Cat1 module, one is a USB to 10/100Mbps Ethernet adapter, and two are USB host interfaces.
2.5 The 4G LTE module supports Qualcomm 4G/GPS, NL668-EU/EAU/AM, GoTone EG25-G.
2.6 The 4G LTE Cat1 module is a plug-and-play in most systems, driver-free and does not require manual dialing, usually recognized as the eth1 network card.
2.7 The 4G LTE Cat module uses a Nano-sized SIM card and offers the option of either an SMA antenna or a first-generation IPEX antenna.
2.8 The expansion board supports other Pi with USB contacts in the same position, such as the Orange Pi Zero 2W.
2.9 Onboard PWR/MODE/ACT LED.
2.10 Onboard reset button for 4G module;
2.11 An optional aluminum alloy enclosure is available.
Note 1: After connecting this expansion board, the Micro USB port on the Zero will no longer be usable.
Note 2: In some systems, it is necessary to disable the OTG function and set the USB mode to Host mode.
Note 3: The expansion board supports all versions of the Raspberry Pi Zero, including the Zero, Zero W, Zero WH, and Zero 2W.
III. Software Spec
3.1 Overview
This document uses the Raspberry Pi OS and OpenWrt system for testing.
The version of the Raspberry Pi OS is: 2024-07-04-raspios-bookworm-arm64.img.xz
You can download the Raspberry Pi OS in:
https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-64-bit
(If using the first-generation Raspberry Pi Zero board, which only supports 32-bit systems, please pay attention to the version you download.)
The version of the OpenWrt is: openwrt-bcm27xx-bcm2709-rpi-2-squashfs-sysupgrade-linux-6.1.98-20240723.img.gz
3.2 Boot from TF card
3.2.1 Use the Imager to flash the system
First, install the Imager on the Windows. You can download it in: https://www.raspberrypi.com/software/
Insert the TF card into the card reader after installation, plug the card reader into the PC's USB port, and then open the software.
Raspberry Pi Device: Choose Raspberry Pi Zero 2 W;
Choose Use Custom, to flash the system image already downloaded onto the hard drive (no internet connection required).
Storge: Select the TF card that needs to be flashed (i.e., the card inserted into the PC's USB port).
After making your selection, press "NEXT." It is recommended to click "Edit Settings" to pre-set some parameters in the flashing software(For example, the system username and password, WiFi connection parameters, whether to enable SSH service, etc.). This way, you won't need to set them again when the system starts up, making it easier to use.
Note: It is recommended to select SSH, as it will be needed later:
If you need to use the pre-set settings, press "Yes"; if you do not need to use the pre-set settings, press "No". Proceed to the next page, and click "Yes" to start the flashing and verification process. After the flashing is complete, follow the prompts to remove the card.
3.2.2 Use the balenaEtcher to flash the system
Install the balenaEtcher on the Windows. You can download it in: https://etcher.balena.io/#download-etcher
Insert the TF card into the card reader after installation, plug the card reader into the PC's USB port, and then open the software.
Flash from file: Select the pre-downloaded Raspberry Pi OS or other image.
Select target: Select the TF card that needs to be flashed (i.e., the card inserted into the PC's USB port).
Then click "Flash!" to start the process, and wait for it to complete.
3.2.3 Boot the system
Remove the TF card from the card reader, insert it into the TF card slot of the Zero Compute Module, and power it up to enter the system.
IV. Work with Raspberry Pi OS
4.1View hardware devices
4.1.1 View USB devices
Open the terminal in Raspberry Pi OS and enter the commandlsusb
, as shown in the image below:
Device 002:External USB Hub;
Device 003:USB to 100Mbps Ethernet adapter;
Device 004:USB2.0-A Interface;
Device 005:4G module;
Device 006:USB2.0-A Interface;
If the system stop at the Raspberry Pi logo and fails to boot:
或者启动后键盘鼠标及4G模组都无法使用,请仔细观察顶针是否对准了镀金触点,并请在PC端打开TF卡系统分区根目录下的config.txt检查USB的初始化脚本:
You need to confirm that the three red-boxed areas in the following image are all configured completely. If not, please manually add the missing parts and save the file:
# otg_mode=1
(It is recommended to comment out as follow)
dtoverlay=dwc2,dr_mode=host
(These two areas must be ensured to be included.)
4.1.2 View network devices
Open the terminal in Raspberry Pi OS and enter the command ifconfig -a
, as shown in the image below:
We can see that eth0 is a USB-to-Ethernet adapter, and usb is a 4G Cat4 connection (with the IP address in the image above is 10.17.34.16), and wlan0 is the wireless network interface (with the IP address in the image above is 192.168.8.71).
4.2 Connect to the system via SSH
For convenience, it is recommended to use SSH software on the PC to connect to the system and perform terminal operations. We use a PC within the same IP subnet as the Raspberry Pi's wireless network card and connect through MobaXterm:
After connecting, most operations can be performed using MobaXterm on the PC side, allowing the entire hardware system to operate without a monitor. The following test operations will be demonstrated using MobaXterm on the PC side.
4.3 Test network devices
4.3.1 ping tests
When testing, there is a priority order. If there are specific requirements for internal and external networks, please adjust the metric values of each network and the DNS server settings.
Use the -I parameter to specify which network interface to start the ping packet from, as shown below:
ping www.mcuzone.com -I eth0
ping www.mcuzone.com -I eth1
Priority can be checked by executing the route
command; the network card with the smaller metric value will be preferred for communication.
We can also force communication through another network by disabling a specific network card. For example, to disable usb0, you can execute the following command:
sudo ifconfig usb0 down
And enable usb0 by the following command:
sudo ifconfig usb0 up
4.3.2 Set network adapter priority
For related settings regarding network card priority, please refer to the following link:
1. Set network adapter priority
2. Using udhcpc to specify DNS servers
3. Examples of how to use udhcpc
4.3.3 Test speed by iperf3
You can download iperf3 (Windows version) in:
http://www.mcuzone.com/down/Software.asp?ID=10000634
Install iperf3 (Linux version) by using the following command:
sudo apt-get install iperf3
100M Ethernet speed test results:
It is about 92.3Mbps in client mode:
It is about 94.8Mbps in server mode:
Note: The USB to 100M Ethernet adapter may not reach full speed due to the performance limitations of the Zero 2W, the USB hub, and the bandwidth usage of the 4G Cat4.
4.4 AT Command for 4G Cat4 Module on Raspberry Pi OS
4.4.1 Open AT Command serial port
To operate 4G Cat1 Module using AT commands on a Raspberry Pi, you first need to open the AT command serial port. The method to open it is as follows:
Input the following command: lsusb
, to open ttyUSB serial port:
Record the ID value of the 4G module: 05c6 90b6
Use the following command to open the ttyUSB serial port, where the value after echo is the ID recorded above:
sudo modprobe option
sudo sh -c 'echo 05c6 90b6 > /sys/bus/usb-serial/drivers/option1/new_id'
After execution is complete, the system should have three additional devices: ttyUSB0, ttyUSB1, and ttyUSB2. Input ls /dev
to view:
Then Open serial port by serial port tool.
Install minicom:
sudo apt-get install minicom
Open AT Command serial port by minicom:
sudo minicom -D /dev/ttyUSB0
Then directly type the AT command and press Enter to see the result. If you need to view the echo, please type the command: ate1
:
Note: The model of the 4G module may change, but the process remains the same. You only need to use lsusb
to check the actual USB ID and replace it with the actual value in subsequent commands. Additionally, some 4G Cat1 modules's chipset IDs have already been included in the kernel's supported list, so these Cat1 modules can be automatically recognized as ttyAMAx without the need to add a USB ID.
4.4.2 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
Return 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.
五、OpenWrt系统操作演示
5.1 概述
此扩展板搭配树莓派Zero 2W,在OpenWrt系统下可配置为一进一出的交换机模式,扩展板上的4G可作为WAN口(直接4G上网),网口配置为LAN口,用于连接PC。
5.2 准备工作
烧写OpenWrt系统并上电启动后,我们通过树莓派自带网口连接网线至PC网口,待PC的网卡与树莓派的网口连接成功后,我们在Windows设置中找到网络和Internet,在以太网中打开连接的网络查看默认网关的IP地址,这个地址就是OpenWrt系统的后台配置页面地址,如图所示,本文测试的地址为192.168.198.1:
然后打开网页浏览器输入192.168.198.1进入OpenWrt系统。默认用户名为root
,默认密码为password:
5.3 设置高通4G LTE模组
登录OpenWrt系统后,点击“Network - Interface”,然后点击“ADD NEW INTERFACE...”:
按照下图进行设置,Name of the new interface为WAN,Protocol of the new interface选择DHCP client,Cover the following interface选择usb0,然后点击“SUBMIT”按钮:
在Firewall Setting中选择WAN口后点击“SAVE & APPLY”按钮:
回到“Network - Interface”,稍等片刻,就可以看见新建的WAN接口获取了IP地址,这样PC就可以通过4G LTE模组上网了:
在PC端打开https://www.speedtest.cn/进行测速,此时流量走的是4G模块,测试结果如下:
5.4 设置国产4G CAT4模组
登录OpenWrt系统后,点击“Network - Interface”,然后点击“ADD NEW INTERFACE...”:
按照下图进行设置,Name of the new interface为WAN,Protocol of the new interface选择DHCP client,Cover the following interface选择eth1,然后点击“SUBMIT”按钮:
在Firewall Setting中选择WAN口后点击“SAVE & APPLY”按钮:
回到“Network - Interface”,稍等片刻,就可以看见新建的WAN接口获取了IP地址,这样PC就可以通过4G LTE模组上网了:
在PC端打开https://www.speedtest.cn/进行测速,此时流量走的是4G模块,测试结果如下:
联系我们
电话:13957118045
如本页面有任何疏漏、错误或者侵权,请通过上述途径联系我们,谢谢!
Copyright 2004-2024 野芯科技