0012 MPUUART/MP4232 EN:修订间差异

来自Mcuzone Wiki
(创建页面,内容为“== '''关键词''' == 树莓派5、PCIe、Switch、VL805、TTL、RS232、RS485、串口 == '''一、简介''' == 树莓派5具备一个16Pin的PCIe接口,我们可以利用该接口进行多种外设的扩展。 我们可以通过PCIe接口搭配PCIe转USB芯片扩展成四路USB接口,然后通过CH344Q芯片实现四路串口。本扩展板分2个版本:一个是MP4232扩展板,即4路RS232的扩展,该扩展板在树莓派系统或者Ubuntu系统…”)
 
 
(未显示同一用户的20个中间版本)
第1行: 第1行:
== '''关键词''' ==
[[0012 MPUUART/MP4232|切换语言为中文]]
树莓派5、PCIe、Switch、VL805、TTL、RS232、RS485、串口


== '''一、简介''' ==
== '''Keywords''' ==
树莓派5具备一个16Pin的PCIe接口,我们可以利用该接口进行多种外设的扩展。
Raspberry Pi 5, PCIe, Switch, VL805, TTL, RS232, RS485, Serial


我们可以通过PCIe接口搭配PCIe转USB芯片扩展成四路USB接口,然后通过CH344Q芯片实现四路串口。本扩展板分2个版本:一个是MP4232扩展板,即4路RS232的扩展,该扩展板在树莓派系统或者Ubuntu系统下无需驱动,上电后即可自动识别成ttyACM0、ttyACM1、ttyACM2、ttyACM3四个RS232串口;另一个版本是MPUUART扩展板,实现双232双485的扩展,该扩展板在树莓派系统或者Ubuntu系统下无需驱动,上电后即可自动识别成ttyACM0、ttyACM1、ttyACM2、ttyACM3,其中ttyACM0和3是RS232串口,ttyACM1和2是RS485串口。
== '''I. Introduction''' ==
The Raspberry Pi 5 features a 16-pin PCIe interface, which can be utilized for the expansion of various peripherals.


RS232波特率可以到230Kbps以上(两个相邻的RS232对接实测可到1.2Mbps)。 TTL/CMOS UART波特率可以到6Mbps;
We can expand into four USB interfaces through the PCIe interface paired with a PCIe to USB chip, and then achieve four serial ports using the CH344Q chip. This expansion board comes in two versions: one is the MP4232 expansion board, which provides an expansion of 4 RS232 ports. This expansion board does not require any drivers under Raspberry Pi or Ubuntu and will be automatically recognized as four RS232 serial ports (ttyACM0, ttyACM1, ttyACM2, ttyACM3) once powered on. The other version is the MPUUART expansion board, which provides an expansion for dual RS232 and dual RS485 ports. This expansion board does not require any drivers under Raspberry Pi or Ubuntu and will be automatically recognized as ttyACM0, ttyACM1, ttyACM2, and ttyACM3 once powered on. Among these, ttyACM0 and ttyACM3 are RS232 serial ports, while ttyACM1 and ttyACM2 are RS485 serial ports.


扩展板上还预留了3路USB2.0口,可用于扩展4G LTE模块,我司配套的4G模块在树莓派系统和Ubuntu OS下均免驱免拨号、系统自动识别、即插即用,无需额外装驱动。
The baud rate for RS232 can reach over 230 Kbps (with a tested speed of up to 1.2 Mbps when two adjacent RS232 ports are connected), while the baud rate for TTL/CMOS UART can reach up to 6 Mbps.


== '''二、硬件资源''' ==
The expansion board also has three USB 2.0 ports reserved, which can be used to extend a 4G LTE module. The 4G module provided by our company is driver-free and dial-up-free on both the Raspberry Pi and Ubuntu. The system automatically recognizes it, allowing for plug-and-play functionality without the need to install additional drivers.
1. 一路PCIe接口,0.5mm 16P FPC和树莓派5通讯,采用PCIe转四路高速USB2.0设计;


2. 三路HS USB2.0,1.25mm-4P接口,可扩展CM4 4G Mini模组;
== '''II. Hardware Spec''' ==
1. One PCIe interface, 0.5mm 16P FPC for communication with Raspberry Pi 5, adopting a design of PCIe to four high-speed USB2.0.


3. MPUUART扩展板,通过USB2.0高速接口转出四路串口,实现两路RS232+两路RS485(带电源隔离)设计,其中RS232可以改造为TTL/CMOS电平的UART并通过3.81-3Pin插针引出;
2. Three-way HS USB2.0, 1.25mm-4P interface, expandable CM4 4G Mini module.


4. MP4232扩展板,通过USB2.0高速接口转出四路串口,实现四路RS232设计,3.81-3p端子;
3. The MPUUART expansion board converts four serial ports via a USB 2.0 high-speed interface, featuring two RS232 ports and two RS485 ports with power isolation design. The RS232 ports can be modified to a TTL/CMOS level UART and is led out through a 3.81-3Pin connector.


5. 四个LED,分别是PWR LED(通过树莓派5的PCIe接口取电工作),USB转串口芯片的ACT LED,两个收发LED;
4. The MP4232 expansion board converts four serial ports via a USB 2.0 high-speed interface, implementing a four-channel RS232 design with 3.81-3p terminals.


6. 尺寸:56x85mm,四个M2.5固定孔,和树莓派5—致;
5. Four LEDs are included: a PWR LED that is powered via the Raspberry Pi 5's PCIe interface, an ACT LED for the USB-to-serial chip, and two transmit/receive LEDs.


7. 扩展板预留4G模块的固定孔,并可堆叠1-3路4G模组;
6. Size: 56x85mm, four M2.5 mounting holes, consistent with those on the Raspberry Pi 5;


8. 可选铝合金外壳;
7. The expansion board provides mounting holes for a 4G module and supports stacking of 1-3 4G modules.


9. 可定制接口电平(如定制为4路TTL/CMOS串口,或者4路RS485串口);
8. Aluminum alloy enclosure(OPT).


10. MPUUART线路板沉金工艺,无铅生产,板材通过UL和ROHS认证,防火等级94V-0;
9. Customizable interface levels are available, such as configuring four TTL/CMOS serial ports, or four RS485 serial ports.


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_57.jpg
10. The MPUUART uses gold immersion process, lead-free production, and the material has passed UL and ROHS certifications with a flame retardant rating of 94V-0.


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_58.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_71.jpg


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_59.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_72.jpg


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_62.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_73.jpg


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_60.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_74.jpg


== '''三、系统烧写''' ==
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_75.jpg
我们采用树莓派OS和Ubuntu系统进行测试,因为扩展板是利用树莓派5的PCIe接口,故系统只能从TF卡启动。


树莓派OS的版本为2024-07-04-raspios-bookworm-arm64.img.xz,树莓派OS下载地址:
== '''III. Work with Raspberry Pi OS''' ==
Since the expansion board utilizes the PCIe interface of the Raspberry Pi 5, the system can only be booted from an SD card (TF card).  


https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-64-bit
Please refer to the following link for instructions on how to burn the system image to a TF card:


Ubuntu系统的版本为ubuntu-24.04-preinstalled-desktop-arm64+raspi.img.xz,Ubuntu OS下载地址:
[[0005 MPS2242 2280 2280P EN#3.2 Boot from TF card|Flash the OS using a TF card]]


https://ubuntu.com/download/raspberry-pi
The version of the Raspberry Pi OS is: 2024-07-04-raspios-bookworm-arm64.img.xz


烧写系统镜像到TF卡请参阅下列链接:
You can download the Raspberry Pi OS in:


[[0005 MPS2242 2280 2280P#3.2 从TF卡启动|使用TF卡烧写系统]]
https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-64-bit
 
烧写完毕后,将TF卡从读卡器中取下,插入树莓派开发版的TF卡卡槽,上电后即可进入系统。
 
== '''四、树莓派系统的使用''' ==


=== 4.1 安装串口软件CuteCom ===
=== 3.1 Install CuteCom ===
串口软件CuteCom的安装命令为:
The installation command for CuteCom is:


<code>sudo apt install cutecom</code>
<code>sudo apt install cutecom</code>


安装完毕后,点击桌面左上角的树莓派图标,在“System Tools”有CuteCom的快捷方式:
After installation, click on the Raspberry Pi icon in the top left corner of the desktop, and you will find a shortcut for CuteCom under "System Tools".


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_01.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_01.jpg


=== 4.2 测试MP4232 ===
=== 3.2 Test MP4232 ===
MP4232扩展板的4个串口名称从上到下依次如下:
The names of the four serial ports on the MP4232, from top to bottom, are as follows:


ttyACM3、ttyACM0、ttyACM1、ttyACM2
ttyACM3、ttyACM0、ttyACM1、ttyACM2
第77行: 第73行:
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_55.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_55.jpg


两个RS232串口之间的连接对应关系为:
The connection correspondence between the two RS232 serial ports is:


R - T
R - T
第85行: 第81行:
T - R
T - R


在树莓派终端中输入<code>lsusb</code>,我们可以看到VL805和CH344Q:
Execute <code>lsusb</code>, and we can see VL805 and CH344Q:


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_03.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_03.jpg


输入<code>ls /dev</code>,我们可以看到4个串口ttyACM0、ttyACM1、ttyACM2、ttyACM3:
Execute <code>ls /dev</code>, and we can see four serial ports: ttyACM0、ttyACM1、ttyACM2、ttyACM3:


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_31.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_31.jpg


我们用串口连接线连接任意两个串口,使用CuteCom进行数据收发测试,经测试,树莓派系统下波特率最高可达到1.21M(以传输数据不发生乱码为准):
We use a serial cable to connect any two of the serial ports and perform data transmission tests using CuteCom. According to the tests, under the Raspberry Pi OS, the baud rate can reach up to 1.21 Mbps (based on data transmission without garbling).


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_02.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_02.jpg


=== 4.3 测试MPUUART ===
=== 3.3 Test MPUUART ===
MPUUART扩展板的4个串口,靠上的两个为RS232串口(ttyACM0、ttyACM3),靠下的两个为RS485串口(ttyACM1、ttyACM2)。
The MPUUART has four serial ports; the two on top are RS232 ports (ttyACM0, ttyACM3), and the two at the bottom are RS485 ports (ttyACM1, ttyACM2).


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_56.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_56.jpg


两个RS485串口之间的连接对应关系为:
The connection correspondence between the two RS485 serial ports is:


G - G
G - G
第110行: 第106行:
B - B
B - B


在树莓派终端中输入<code>lsusb</code>,我们可以看到VL805和CH344Q:
Execute <code>lsusb</code>, and we can see VL805 and CH344Q:


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_10.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_10.jpg


输入<code>ls /dev</code>,我们可以看到4个串口ttyACM0、ttyACM1、ttyACM2、ttyACM3:
Execute <code>ls /dev</code>, and we can see four serial ports: ttyACM0、ttyACM1、ttyACM2、ttyACM3:


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_32.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_32.jpg


我们用串口连接线连接两个RS232串口,使用CuteCom进行数据收发测试,经测试,树莓派系统下波特率最高可达到1.22M(以传输数据不发生乱码为准):
We use a serial cable to connect two of the RS232 serial ports and perform data transmission tests using CuteCom. According to the tests, under the Raspberry Pi OS, the baud rate can reach up to 1.22 Mbps (based on data transmission without garbling).


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_12.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_12.jpg


我们用串口连接线连接两个RS485串口,使用CuteCom进行数据收发测试,经测试,树莓派系统下波特率最高可达到2.02M(以传输数据不发生乱码为准):
We use a serial cable to connect two of the RS485 serial ports and perform data transmission tests using CuteCom. According to the tests, under the Raspberry Pi OS, the baud rate can reach up to 2.02 Mbps (based on data transmission without garbling).


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_13.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_13.jpg


=== 4.4 测试4G模块 ===
=== 3.4 Test 4G module ===
我司配套的CM4 4Gmini模块,在树莓派系统下均为免驱免拨号,自动识别,即插即用。4G型号分CM4 4G mini(CAT4 4G),高通4G,高通4G-GPS。
The CM4 4G mini module provided by our company is driver-free, does not require dialing, and is automatically recognized with plug-and-play functionality under the Raspberry Pi system. The 4G models include CM4 4G mini (CAT4 4G), Qualcomm 4G, and Qualcomm 4G-GPS.
 
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_64.jpg


CAT4 4G版本在系统里识别成eth设备,高通4G在系统里识别成usb0设备。
The CAT4 4G is recognized as an eth device in the system, while the Qualcomm 4G is recognized as a usb0 device in the system.http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_39.jpg


==== 4.4.1 模块连接 ====
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_77.jpg
系统上电启动运行树莓派官方os后,在树莓派终端中执行命令<code>lsusb</code>,如下图所示:
 
==== 3.4.1 Module connection ====
After starting Raspberry Pi OS, execute <code>lsusb</code>, as shown in the following image:


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_41.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_41.jpg


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_42.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_78.jpg


在树莓派终端中执行<code>ifconfig -a</code>,我们可以看到4G模块(eth1或usb0)已经正确获得了IP地址:
Execute <code>ifconfig -a</code>, and we can see that the 4G module (eth1 or usb0) has correctly obtained an IP address.


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_39.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_39.jpg


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_40.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_77.jpg


如果此时看不到4G模块(eth1),请检查连线是否正确,以及使用<code>lsusb</code>命令查看模块是否被系统识别。
If you cannot see the 4G module (eth1), please check if the connections are correct and use the <code>lsusb</code> command to verify if the module is recognized by the OS.


Statu LED灯状态如下:
The status of Status LED:


'''CAT4 4G:'''
'''CAT4 4G:'''


闪烁状态为1.8秒亮0.2秒灭(也可以通过亮的时间比灭的时间长来判断)表示4G模组已经联网。
The blinking pattern, where the light is on for 1.8 seconds and off for 0.2 seconds (alternatively, you can judge by the light being on longer than it is off), indicates that the 4G module has connected to the network.


闪烁状态是1.8秒灭0.2秒亮,说明SIM卡或者网络有问题,请检查SIM卡和天线。
The blinking pattern, where the light is off for 1.8 seconds and on for 0.2 seconds, indicates that there is an issue with the SIM card or the network. Please check the SIM card and the antenna.


'''高通4G:'''
'''Qualcomm 4G:'''


闪烁状态为慢闪,中间有短暂快闪,表示4G模组已经联网;否则说明SIM卡或者网络有问题,请检查SIM卡和天线。
If the LED is blinking slowly with occasional rapid flashes in between, it indicates that the 4G module has connected to the network. Otherwise, it suggests there might be an issue with the SIM card or the network; please check the SIM card and the antenna.


4G模组正确获得ip地址后,我们可以ping外网地址,如:
After the 4G module correctly obtains an IP address, we can ping an external web address, such as:


<code>ping www.mcuzone.com</code>
<code>ping www.mcuzone.com</code>
第164行: 第164行:
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_43.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_43.jpg


也可以通过4G模块连接外网,访问[https://www.speedtest.cn/ 测速网站]测速,结果如下:
You can also connect to the external network through the 4G module and visit a [https://www.speedtest.cn/ speed test website] to measure the speed:


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_44.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_44.jpg


'''''注意:网络测速受网络环境和测试方法影响,速度请以实际为准,本测试仅供参考。'''''
'''''Note: Network speed tests are affected by the network environment and testing methods. Please refer to the actual speed, as this test is for reference only.'''''


==== 4.4.2 使用AT命令 ====
==== 3.4.2 AT command operation ====
以CAT4 4G为例,在树莓派终端中执行命令<code>lsusb</code>,如下图所示:
Taking CAT4 4G as an example, execute <code>lsusb</code> in terminal:


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_41.jpg
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_04.jpg


本模块的id为05c6 90b6,记录下这个值。
Record the ID value of the 4G module: 05c6 90b6


使用下列命令打开ttyUSB串口,其中echo后面的值就是之前记录的ID值:
Use the following command to open the ttyUSB serial port, where the value after echo is the ID recorded above:


<code>sudo modprobe option</code>
<code>sudo modprobe option</code>
第183行: 第183行:
<code>sudo sh -c 'echo 05c6 90b6 > /sys/bus/usb-serial/drivers/option1/new_id'</code>
<code>sudo sh -c 'echo 05c6 90b6 > /sys/bus/usb-serial/drivers/option1/new_id'</code>


执行以上两条命令后系统应该会多出ttyUSB0-3三个设备,输入<code>ls /dev/ttyUSB*</code>可以查看:
After execution is complete, the system should have four additional devices: ttyUSB0 - ttyUSB3, execute <code>ls /dev/ttyUSB*</code> to view:


http://www.mcuzone.com/wiki/5002_CM5_Basic/5002_CM5_Basic_60.jpg
http://www.mcuzone.com/wiki/5002_CM5_Basic/5002_CM5_Basic_60.jpg


安装minicom工具:
Install minicom:


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


通过minicom打开AT命令串口:
Open AT Command serial port by minicom:


<code>sudo minicom -D /dev/ttyUSB1</code>
<code>sudo minicom -D /dev/ttyUSB1</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 the echo, please type the command <code>ate1</code>, then execute other commands.


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_45.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_45.jpg


常用AT命令:
Common AT command:


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.


==== 4.4.3 修改4G模组的IP地址 ====
==== 3.4.3 Modify the IP address of the 4G module ====
如果出厂默认的4G IP地址和用户使用的IP地址有冲突,或有修改IP地址的需求,可按照下列步骤进行修改:
If the default 4G IP address assigned at the factory conflicts with the IP address being used by the user, or if there is a need to modify the IP address, you can change the 4G module's IP to directly obtain a public IP.


'''CAT4 4G模块:'''
'''CAT4 4G:'''


执行AT命令:
Execute the AT command:


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


注意,只支持192.168.x.1这样格式的地址,如果设置了<code>AT+ROUTEIP=192.168.3.1</code>,最终获得的IP为192.168.3.100,修改完后需断电重启系统。
Note: only addresses in the format of 192.168.x.1 are supported. If you set <code>AT+ROUTEIP=192.168.3.1</code>, the final IP address obtained will be 192.168.3.100. After making the changes, you need to power off and restart the OS.


查询当前IP:<code>AT+ROUTEIP?</code>,返回两个值,前一个为旧IP,后一个为新IP。
Query current IP: <code>AT+ROUTEIP?</code>, it returns two values, the first one is the old IP, and the second one is the new IP.


测试命令:<code>AT+ROUTEIP=?</code>
Test command: <code>AT+ROUTEIP=?</code>


'''高通 4G模块:'''
'''Qualcomm 4G:'''


将4G模块的IP改为直接获取公网IP即可,请执行AT命令:
Set the 4G module's IP to directly obtain a public IP. Please execute the AT command:


设置IP为公网:<code>AT+GTIPPASS=1</code>
Set the IP to public: <code>AT+GTIPPASS=1</code>


设置IP为内网:<code>AT+GTIPPASS=0</code>
Set the IP to private: <code>AT+GTIPPASS=0</code>


查询当前IP为公网还是内网:<code>AT+GTIPPASS?</code>
Check whether the current IP is a public or private IP: <code>AT+GTIPPASS?</code>


修改IP完毕后需要断电重启才能生效。
After modifying the IP, a power cycle reboot is required for the changes to take effect.


==== 4.4.4 GPS测试(适用于高通4G-GPS版本) ====
==== 3.4.4 GPS test (Applicable to the Qualcomm 4G-GPS) ====
如果你选择的是高通4G-GPS版本,则此4G附带GPS功能,需要接GPS无源天线,且确保GPS天线甩出户外。
If you have chosen the Qualcomm 4G-GPS, this 4G module comes with GPS functionality. You need to connect a passive GPS antenna and ensure that the GPS antenna is placed outdoors.


输入命令<code>lsusb</code>,如下图所示:
Execute the command <code>lsusb</code>, as shown in the figure below:


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_46.jpg
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_04.jpg


记下4G模块的ID值:1508 1001
Note down the ID of the 4G module: 05c6 90b6.


使用下列命令打开ttyUSB串口,其中echo后面的值就是上面记录的ID值:
Use the following command to open the ttyUSB serial port, where the value following echo is the ID value recorded above:


<code>sudo modprobe option</code>
<code>sudo modprobe option</code>


<code>sudo sh -c 'echo 1508 1001 > /sys/bus/usb-serial/drivers/option1/new_id'</code>
<code>sudo sh -c 'echo 05c6 90b6 > /sys/bus/usb-serial/drivers/option1/new_id'</code>
 
After executing the two commands above, the system should have three additional devices: ttyUSB0/1/2. You can check them by executing <code>ls /dev</code>:
 
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_06.jpg


执行以上两条命令后系统应该会多出ttyUSB0-3三个设备,输入<code>ls /dev/ttyUSB*</code>可以查看:
Execute minicom and open the ttyUSB0 serial port:


http://www.mcuzone.com/wiki/5002_CM5_Basic/5002_CM5_Basic_60.jpg
<code>sudo minicom -D /dev/ttyUSB0</code>
 
Then execute:


运行minicom,打开ttyUSB1串口:
<code>at+gtgpsepo=1</code> //Enable AGPS


<code>sudo minicom -D /dev/ttyUSB1</code>
<code>at+gtgpspower=1</code> //Enable GPS


并运行:
Wait a moment for the positioning to succeed, then execute:


<code>AT+GTGPSPOWER=1</code> //打开GPS
<code>at+gtgps?</code> //View NMEA information


运行成功后打开ttyUSB3:
You can then see that the serial port outputs GPS information:


<code>sudo minicom -D /dev/ttyUSB3</code>
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_70.jpg


就可以看到该串口有GPS信息输出,稍等片刻即可定位:
== '''IV. Work with Ubuntu OS''' ==
The version of the Ubuntu OS is: ubuntu-24.04-preinstalled-desktop-arm64+raspi.img.xz,


http://www.mcuzone.com/wiki/5002_CM5_Basic/5002_CM5_Basic_61.jpg
You can download the Ubuntu OS in:


== '''五、Ubuntu系统的使用''' ==
https://ubuntu.com/download/raspberry-pi


=== 5.1 安装串口软件CuteCom ===
=== 4.1 Install CuteCom ===
串口软件CuteCom的安装命令为:
The installation command for CuteCom is:


<code>sudo apt install cutecom</code>
<code>sudo apt install cutecom</code>


安装完毕后,点击桌面左下角的“Show Apps”图标,有CuteCom的快捷方式:
After installation, click on the "Show Apps" icon in the lower left corner of the desktop. There will be a shortcut for CuteCom.


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_05.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_05.jpg


但是如果在此直接打开CuteCom,有可能会出现Input框无法输入字符的问题,这是由于权限不足造成的,所以需要打开Ubuntu终端,输入:
But if you directly open CuteCom, there might be an issue where the input box does not accept characters. This is caused by insufficient permissions. So you need to open the terminal and execute:


<code>sudo cutecom</code>
<code>sudo cutecom</code>
第320行: 第327行:
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_06.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_06.jpg


来打开CuteCom,如果需要打开第二个CuteCom,则需要再开一个Ubuntu终端,输入打开CuteCom的命令。
to open CuteCom. If you need to open a second instance of CuteCom, you will have to open another terminal and execute the command to launch CuteCom.


=== 5.2 测试MP4232 ===
=== 4.2 Test MP4232 ===
MP4232扩展板的4个232串口名称从上到下依次如下:
The names of the four serial ports on the MP4232, from top to bottom, are as follows:


ttyACM3、ttyACM0、ttyACM1、ttyACM2
ttyACM3、ttyACM0、ttyACM1、ttyACM2
第329行: 第336行:
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_55.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_55.jpg


两个RS232串口之间的连接对应关系为:
The connection correspondence between the two RS232 serial ports is:


R - T
R - T
第337行: 第344行:
T - R
T - R


在Ubuntu终端中输入<code>lsusb</code>,我们可以看到VL805和CH344Q:
Execute <code>lsusb</code>, and we can see VL805 and CH344Q:


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_07.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_07.jpg


输入<code>ls /dev</code>,我们可以看到4个串口ttyACM0、ttyACM1、ttyACM2、ttyACM3:
Execute <code>ls /dev</code>, and we can see four serial ports: ttyACM0、ttyACM1、ttyACM2、ttyACM3:


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_33.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_33.jpg


我们用串口连接线连接任意两个串口,使用CuteCom进行数据收发测试,经测试,Ubuntu系统下波特率最高可达到1.15M(以传输数据不发生乱码为准):
We use a serial cable to connect any two of the serial ports and perform data transmission tests using CuteCom. According to the tests, under the Ubuntu OS, the baud rate can reach up to 1.15 Mbps (based on data transmission without garbling).


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_09.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_09.jpg


=== 5.3 测试MPUUART ===
=== 4.3 Test MPUUART ===
MPUUART扩展板的4个串口,靠上的两个为RS232串口(ttyACM0、ttyACM3),靠下的两个为RS485串口(ttyACM1、ttyACM2)。
The MPUUART has four serial ports; the two on top are RS232 ports (ttyACM0, ttyACM3), and the two at the bottom are RS485 ports (ttyACM1, ttyACM2).


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_56.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_56.jpg


两个RS485串口之间的连接对应关系为:
The connection correspondence between the two RS485 serial ports is:


G - G
G - G
第362行: 第369行:
B - B
B - B


在Ubuntu终端中输入<code>lsusb</code>,我们可以看到VL805和CH344Q:
Execute <code>lsusb</code>, and we can see VL805 and CH344Q:


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_14.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_14.jpg


输入<code>ls /dev</code>,我们可以看到4个串口ttyACM0、ttyACM1、ttyACM2、ttyACM3:
Execute <code>ls /dev</code>, and we can see four serial ports: ttyACM0、ttyACM1、ttyACM2、ttyACM3:


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_34.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_34.jpg


我们用串口连接线连接两个RS232串口,使用CuteCom进行数据收发测试,经测试,树莓派系统下波特率最高可达到1.26M(以传输数据不发生乱码为准):
We use a serial cable to connect two of the RS232 serial ports and perform data transmission tests using CuteCom. According to the tests, under the Ubuntu OS, the baud rate can reach up to 1.26 Mbps (based on data transmission without garbling).


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_16.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_16.jpg


我们用串口连接线连接两个RS485串口,使用CuteCom进行数据收发测试,经测试,树莓派系统下波特率最高可达到1.98M(以传输数据不发生乱码为准):
We use a serial cable to connect two of the RS485 serial ports and perform data transmission tests using CuteCom. According to the tests, under the Ubuntu OS, the baud rate can reach up to 1.98 Mbps (based on data transmission without garbling).


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_17.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_17.jpg


{{联系我们_图标}}
=== 4.4 Test 4G module ===
The CM4 4G mini module provided by our company is driver-free, does not require dialing, and is automatically recognized with plug-and-play functionality under the Ubuntu OS. You need to insert a mobile SIM card (4G or above) and connect the antenna. The 4G models include CM4 4G mini (CAT4 4G), Qualcomm 4G, Qualcomm 4G-GPS.
 
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_63.jpg
 
The 4G module is recognized as a device starting with "enx..." in the Ubuntu OS. Other operations with 4G, such as using AT commands, modifying IP addresses, or utilizing GPS, are the same as on the Raspberry Pi OS. These will not be repeated here.
 
After starting Ubuntu OS, execute <code>lsusb</code>, as shown in the following image:
 
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_65.jpg
 
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_79.jpg
 
Execute <code>ifconfig -a</code>, and we can see that the 4G module (enx...) has correctly obtained an IP address.
 
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_67.jpg
 
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_80.jpg
 
The status of Status LED:
 
'''CAT4 4G:'''
 
The blinking pattern, where the light is on for 1.8 seconds and off for 0.2 seconds (alternatively, you can judge by the light being on longer than it is off), indicates that the 4G module has connected to the network.
 
The blinking pattern, where the light is off for 1.8 seconds and on for 0.2 seconds, indicates that there is an issue with the SIM card or the network. Please check the SIM card and the antenna.
 
'''Qualcomm 4G:'''
 
If the LED is blinking slowly with occasional rapid flashes in between, it indicates that the 4G module has connected to the network. Otherwise, it suggests there might be an issue with the SIM card or the network; please check the SIM card and the antenna.
 
After the 4G module correctly obtains an IP address, we can ping an external web address, such as:
 
<code>ping www.mcuzone.com</code>
 
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_69.jpg
 
You can also connect to the external network through the 4G module and visit a [https://www.speedtest.cn/ speed test website] to measure the speed:
 
http://www.mcuzone.com/wiki/3101_Domestic_4G/3101_Domestic_4G_31.jpg
 
'''''Note: Network speed tests are affected by the network environment and testing methods. Please refer to the actual speed, as this test is for reference only.'''''
 
== '''V. Optional Features''' ==
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_81.jpg
 
{{Contact_Us_icon}}


[http://wiki.mcuzone.com/index.php?title=0012_MPUUART_MP4232%EF%BC%88%E5%A4%9A%E8%B7%AF%E4%B8%B2%E5%8F%A3%E6%89%A9%E5%B1%95%E6%9D%BF%EF%BC%89&veaction=edit T]
[http://wiki.mcuzone.com/index.php?title=0012_MPUUART_MP4232%EF%BC%88%E5%A4%9A%E8%B7%AF%E4%B8%B2%E5%8F%A3%E6%89%A9%E5%B1%95%E6%9D%BF%EF%BC%89&veaction=edit T]

2025年2月11日 (二) 11:54的最新版本

切换语言为中文

Keywords

Raspberry Pi 5, PCIe, Switch, VL805, TTL, RS232, RS485, Serial

I. Introduction

The Raspberry Pi 5 features a 16-pin PCIe interface, which can be utilized for the expansion of various peripherals.

We can expand into four USB interfaces through the PCIe interface paired with a PCIe to USB chip, and then achieve four serial ports using the CH344Q chip. This expansion board comes in two versions: one is the MP4232 expansion board, which provides an expansion of 4 RS232 ports. This expansion board does not require any drivers under Raspberry Pi or Ubuntu and will be automatically recognized as four RS232 serial ports (ttyACM0, ttyACM1, ttyACM2, ttyACM3) once powered on. The other version is the MPUUART expansion board, which provides an expansion for dual RS232 and dual RS485 ports. This expansion board does not require any drivers under Raspberry Pi or Ubuntu and will be automatically recognized as ttyACM0, ttyACM1, ttyACM2, and ttyACM3 once powered on. Among these, ttyACM0 and ttyACM3 are RS232 serial ports, while ttyACM1 and ttyACM2 are RS485 serial ports.

The baud rate for RS232 can reach over 230 Kbps (with a tested speed of up to 1.2 Mbps when two adjacent RS232 ports are connected), while the baud rate for TTL/CMOS UART can reach up to 6 Mbps.

The expansion board also has three USB 2.0 ports reserved, which can be used to extend a 4G LTE module. The 4G module provided by our company is driver-free and dial-up-free on both the Raspberry Pi and Ubuntu. The system automatically recognizes it, allowing for plug-and-play functionality without the need to install additional drivers.

II. Hardware Spec

1. One PCIe interface, 0.5mm 16P FPC for communication with Raspberry Pi 5, adopting a design of PCIe to four high-speed USB2.0.

2. Three-way HS USB2.0, 1.25mm-4P interface, expandable CM4 4G Mini module.

3. The MPUUART expansion board converts four serial ports via a USB 2.0 high-speed interface, featuring two RS232 ports and two RS485 ports with power isolation design. The RS232 ports can be modified to a TTL/CMOS level UART and is led out through a 3.81-3Pin connector.

4. The MP4232 expansion board converts four serial ports via a USB 2.0 high-speed interface, implementing a four-channel RS232 design with 3.81-3p terminals.

5. Four LEDs are included: a PWR LED that is powered via the Raspberry Pi 5's PCIe interface, an ACT LED for the USB-to-serial chip, and two transmit/receive LEDs.

6. Size: 56x85mm, four M2.5 mounting holes, consistent with those on the Raspberry Pi 5;

7. The expansion board provides mounting holes for a 4G module and supports stacking of 1-3 4G modules.

8. Aluminum alloy enclosure(OPT).

9. Customizable interface levels are available, such as configuring four TTL/CMOS serial ports, or four RS485 serial ports.

10. The MPUUART uses gold immersion process, lead-free production, and the material has passed UL and ROHS certifications with a flame retardant rating of 94V-0.

0012_MPUUART_MP4232_71.jpg

0012_MPUUART_MP4232_72.jpg

0012_MPUUART_MP4232_73.jpg

0012_MPUUART_MP4232_74.jpg

0012_MPUUART_MP4232_75.jpg

III. Work with Raspberry Pi OS

Since the expansion board utilizes the PCIe interface of the Raspberry Pi 5, the system can only be booted from an SD card (TF card).

Please refer to the following link for instructions on how to burn the system image to a TF card:

Flash the OS using a TF card

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

3.1 Install CuteCom

The installation command for CuteCom is:

sudo apt install cutecom

After installation, click on the Raspberry Pi icon in the top left corner of the desktop, and you will find a shortcut for CuteCom under "System Tools".

0012_MPUUART_MP4232_01.jpg

3.2 Test MP4232

The names of the four serial ports on the MP4232, from top to bottom, are as follows:

ttyACM3、ttyACM0、ttyACM1、ttyACM2

0012_MPUUART_MP4232_55.jpg

The connection correspondence between the two RS232 serial ports is:

R - T

G - G

T - R

Execute lsusb, and we can see VL805 and CH344Q:

0012_MPUUART_MP4232_03.jpg

Execute ls /dev, and we can see four serial ports: ttyACM0、ttyACM1、ttyACM2、ttyACM3:

0012_MPUUART_MP4232_31.jpg

We use a serial cable to connect any two of the serial ports and perform data transmission tests using CuteCom. According to the tests, under the Raspberry Pi OS, the baud rate can reach up to 1.21 Mbps (based on data transmission without garbling).

0012_MPUUART_MP4232_02.jpg

3.3 Test MPUUART

The MPUUART has four serial ports; the two on top are RS232 ports (ttyACM0, ttyACM3), and the two at the bottom are RS485 ports (ttyACM1, ttyACM2).

0012_MPUUART_MP4232_56.jpg

The connection correspondence between the two RS485 serial ports is:

G - G

A - A

B - B

Execute lsusb, and we can see VL805 and CH344Q:

0012_MPUUART_MP4232_10.jpg

Execute ls /dev, and we can see four serial ports: ttyACM0、ttyACM1、ttyACM2、ttyACM3:

0012_MPUUART_MP4232_32.jpg

We use a serial cable to connect two of the RS232 serial ports and perform data transmission tests using CuteCom. According to the tests, under the Raspberry Pi OS, the baud rate can reach up to 1.22 Mbps (based on data transmission without garbling).

0012_MPUUART_MP4232_12.jpg

We use a serial cable to connect two of the RS485 serial ports and perform data transmission tests using CuteCom. According to the tests, under the Raspberry Pi OS, the baud rate can reach up to 2.02 Mbps (based on data transmission without garbling).

0012_MPUUART_MP4232_13.jpg

3.4 Test 4G module

The CM4 4G mini module provided by our company is driver-free, does not require dialing, and is automatically recognized with plug-and-play functionality under the Raspberry Pi system. The 4G models include CM4 4G mini (CAT4 4G), Qualcomm 4G, and Qualcomm 4G-GPS.

0012_MPUUART_MP4232_64.jpg

The CAT4 4G is recognized as an eth device in the system, while the Qualcomm 4G is recognized as a usb0 device in the system.0012_MPUUART_MP4232_39.jpg

0012_MPUUART_MP4232_77.jpg

3.4.1 Module connection

After starting Raspberry Pi OS, execute lsusb, as shown in the following image:

0012_MPUUART_MP4232_41.jpg

0012_MPUUART_MP4232_78.jpg

Execute ifconfig -a, and we can see that the 4G module (eth1 or usb0) has correctly obtained an IP address.

0012_MPUUART_MP4232_39.jpg

0012_MPUUART_MP4232_77.jpg

If you cannot see the 4G module (eth1), please check if the connections are correct and use the lsusb command to verify if the module is recognized by the OS.

The status of Status LED:

CAT4 4G:

The blinking pattern, where the light is on for 1.8 seconds and off for 0.2 seconds (alternatively, you can judge by the light being on longer than it is off), indicates that the 4G module has connected to the network.

The blinking pattern, where the light is off for 1.8 seconds and on for 0.2 seconds, indicates that there is an issue with the SIM card or the network. Please check the SIM card and the antenna.

Qualcomm 4G:

If the LED is blinking slowly with occasional rapid flashes in between, it indicates that the 4G module has connected to the network. Otherwise, it suggests there might be an issue with the SIM card or the network; please check the SIM card and the antenna.

After the 4G module correctly obtains an IP address, we can ping an external web address, such as:

ping www.mcuzone.com

0012_MPUUART_MP4232_43.jpg

You can also connect to the external network through the 4G module and visit a speed test website to measure the speed:

0012_MPUUART_MP4232_44.jpg

Note: Network speed tests are affected by the network environment and testing methods. Please refer to the actual speed, as this test is for reference only.

3.4.2 AT command operation

Taking CAT4 4G as an example, execute lsusb in terminal:

0024_MP4GUSB_04.jpg

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 four additional devices: ttyUSB0 - ttyUSB3, execute ls /dev/ttyUSB* to view:

5002_CM5_Basic_60.jpg

Install minicom:

sudo apt-get install minicom

Open AT Command serial port by minicom:

sudo minicom -D /dev/ttyUSB1

(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 the echo, please type the command ate1, then execute other commands.

0012_MPUUART_MP4232_45.jpg

Common AT command:

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.

3.4.3 Modify the IP address of the 4G module

If the default 4G IP address assigned at the factory conflicts with the IP address being used by the user, or if there is a need to modify the IP address, you can change the 4G module's IP to directly obtain a public IP.

CAT4 4G:

Execute the AT command:

AT+ROUTEIP=<newip>

Note: only addresses in the format of 192.168.x.1 are supported. If you set AT+ROUTEIP=192.168.3.1, the final IP address obtained will be 192.168.3.100. After making the changes, you need to power off and restart the OS.

Query current IP: AT+ROUTEIP?, it returns two values, the first one is the old IP, and the second one is the new IP.

Test command: AT+ROUTEIP=?

Qualcomm 4G:

Set the 4G module's IP to directly obtain a public IP. Please execute the AT command:

Set the IP to public: AT+GTIPPASS=1

Set the IP to private: AT+GTIPPASS=0

Check whether the current IP is a public or private IP: AT+GTIPPASS?

After modifying the IP, a power cycle reboot is required for the changes to take effect.

3.4.4 GPS test (Applicable to the Qualcomm 4G-GPS)

If you have chosen the Qualcomm 4G-GPS, this 4G module comes with GPS functionality. You need to connect a passive GPS antenna and ensure that the GPS antenna is placed outdoors.

Execute the command lsusb, as shown in the figure below:

0024_MP4GUSB_04.jpg

Note down the ID of the 4G module: 05c6 90b6.

Use the following command to open the ttyUSB serial port, where the value following echo is the ID value recorded above:

sudo modprobe option

sudo sh -c 'echo 05c6 90b6 > /sys/bus/usb-serial/drivers/option1/new_id'

After executing the two commands above, the system should have three additional devices: ttyUSB0/1/2. You can check them by executing ls /dev:

0024_MP4GUSB_06.jpg

Execute minicom and open the ttyUSB0 serial port:

sudo minicom -D /dev/ttyUSB0

Then execute:

at+gtgpsepo=1 //Enable AGPS

at+gtgpspower=1 //Enable GPS

Wait a moment for the positioning to succeed, then execute:

at+gtgps? //View NMEA information

You can then see that the serial port outputs GPS information:

0012_MPUUART_MP4232_70.jpg

IV. Work with Ubuntu OS

The version of the Ubuntu OS is: ubuntu-24.04-preinstalled-desktop-arm64+raspi.img.xz,

You can download the Ubuntu OS in:

https://ubuntu.com/download/raspberry-pi

4.1 Install CuteCom

The installation command for CuteCom is:

sudo apt install cutecom

After installation, click on the "Show Apps" icon in the lower left corner of the desktop. There will be a shortcut for CuteCom.

0012_MPUUART_MP4232_05.jpg

But if you directly open CuteCom, there might be an issue where the input box does not accept characters. This is caused by insufficient permissions. So you need to open the terminal and execute:

sudo cutecom

0012_MPUUART_MP4232_06.jpg

to open CuteCom. If you need to open a second instance of CuteCom, you will have to open another terminal and execute the command to launch CuteCom.

4.2 Test MP4232

The names of the four serial ports on the MP4232, from top to bottom, are as follows:

ttyACM3、ttyACM0、ttyACM1、ttyACM2

0012_MPUUART_MP4232_55.jpg

The connection correspondence between the two RS232 serial ports is:

R - T

G - G

T - R

Execute lsusb, and we can see VL805 and CH344Q:

0012_MPUUART_MP4232_07.jpg

Execute ls /dev, and we can see four serial ports: ttyACM0、ttyACM1、ttyACM2、ttyACM3:

0012_MPUUART_MP4232_33.jpg

We use a serial cable to connect any two of the serial ports and perform data transmission tests using CuteCom. According to the tests, under the Ubuntu OS, the baud rate can reach up to 1.15 Mbps (based on data transmission without garbling).

0012_MPUUART_MP4232_09.jpg

4.3 Test MPUUART

The MPUUART has four serial ports; the two on top are RS232 ports (ttyACM0, ttyACM3), and the two at the bottom are RS485 ports (ttyACM1, ttyACM2).

0012_MPUUART_MP4232_56.jpg

The connection correspondence between the two RS485 serial ports is:

G - G

A - A

B - B

Execute lsusb, and we can see VL805 and CH344Q:

0012_MPUUART_MP4232_14.jpg

Execute ls /dev, and we can see four serial ports: ttyACM0、ttyACM1、ttyACM2、ttyACM3:

0012_MPUUART_MP4232_34.jpg

We use a serial cable to connect two of the RS232 serial ports and perform data transmission tests using CuteCom. According to the tests, under the Ubuntu OS, the baud rate can reach up to 1.26 Mbps (based on data transmission without garbling).

0012_MPUUART_MP4232_16.jpg

We use a serial cable to connect two of the RS485 serial ports and perform data transmission tests using CuteCom. According to the tests, under the Ubuntu OS, the baud rate can reach up to 1.98 Mbps (based on data transmission without garbling).

0012_MPUUART_MP4232_17.jpg

4.4 Test 4G module

The CM4 4G mini module provided by our company is driver-free, does not require dialing, and is automatically recognized with plug-and-play functionality under the Ubuntu OS. You need to insert a mobile SIM card (4G or above) and connect the antenna. The 4G models include CM4 4G mini (CAT4 4G), Qualcomm 4G, Qualcomm 4G-GPS.

0012_MPUUART_MP4232_63.jpg

The 4G module is recognized as a device starting with "enx..." in the Ubuntu OS. Other operations with 4G, such as using AT commands, modifying IP addresses, or utilizing GPS, are the same as on the Raspberry Pi OS. These will not be repeated here.

After starting Ubuntu OS, execute lsusb, as shown in the following image:

0012_MPUUART_MP4232_65.jpg

0012_MPUUART_MP4232_79.jpg

Execute ifconfig -a, and we can see that the 4G module (enx...) has correctly obtained an IP address.

0012_MPUUART_MP4232_67.jpg

0012_MPUUART_MP4232_80.jpg

The status of Status LED:

CAT4 4G:

The blinking pattern, where the light is on for 1.8 seconds and off for 0.2 seconds (alternatively, you can judge by the light being on longer than it is off), indicates that the 4G module has connected to the network.

The blinking pattern, where the light is off for 1.8 seconds and on for 0.2 seconds, indicates that there is an issue with the SIM card or the network. Please check the SIM card and the antenna.

Qualcomm 4G:

If the LED is blinking slowly with occasional rapid flashes in between, it indicates that the 4G module has connected to the network. Otherwise, it suggests there might be an issue with the SIM card or the network; please check the SIM card and the antenna.

After the 4G module correctly obtains an IP address, we can ping an external web address, such as:

ping www.mcuzone.com

0012_MPUUART_MP4232_69.jpg

You can also connect to the external network through the 4G module and visit a speed test website to measure the speed:

3101_Domestic_4G_31.jpg

Note: Network speed tests are affected by the network environment and testing methods. Please refer to the actual speed, as this test is for reference only.

V. Optional Features

0012_MPUUART_MP4232_81.jpg

Contact Us

0001_x.jpg 0002_fb.jpg 0004_ytb.jpg 0003_bb.jpg 0005_qq.jpg QQ:8204136

Email: mcuzone@vip.qq.com

Tel: +86(0)13957118045

If there are any omissions, errors, or infringements on this page, please contact us through the above methods. Thank you!

Copyright 2004-2025 Wildchip

T