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系统…”)
 
无编辑摘要
第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 OS or Ubuntu OS 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 systems and will be automatically recognized as ttyACM0, ttyACM1, ttyACM2, and ttyACM3 upon 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 system and Ubuntu OS. 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.
 
10. The MPUUART circuit board 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_57.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_57.jpg
第42行: 第44行:
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_60.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_60.jpg


== '''三、系统烧写''' ==
== '''III. Software Spec''' ==
我们采用树莓派OS和Ubuntu系统进行测试,因为扩展板是利用树莓派5的PCIe接口,故系统只能从TF卡启动。
We conducted tests using Raspberry Pi OS and Ubuntu systems. 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).


树莓派OS的版本为2024-07-04-raspios-bookworm-arm64.img.xz,树莓派OS下载地址:
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
https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-64-bit


Ubuntu系统的版本为ubuntu-24.04-preinstalled-desktop-arm64+raspi.img.xz,Ubuntu OS下载地址:
The version of the Ubuntu system is: ubuntu-24.04-preinstalled-desktop-arm64+raspi.img.xz
 
You can download the Raspberry Pi OS in:


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


烧写系统镜像到TF卡请参阅下列链接:
Please refer to the following link for instructions on how to burn the system image to a TF card:


[[0005 MPS2242 2280 2280P#3.2 从TF卡启动|使用TF卡烧写系统]]
[[0005 MPS2242 2280 2280P EN#3.2 Boot from TF card|Flash the system using a TF card]]


烧写完毕后,将TF卡从读卡器中取下,插入树莓派开发版的TF卡卡槽,上电后即可进入系统。
After flashing is complete, remove the TF card from the card reader and insert it into the TF card slot of the Raspberry Pi development board. Power it on to boot into the system.


== '''四、树莓派系统的使用''' ==
== '''IV. Work with Raspberry Pi OS''' ==


=== 4.1 安装串口软件CuteCom ===
=== 4.1 安装串口软件CuteCom ===

2025年1月10日 (五) 17:23的版本

切换语言为中文

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 OS or Ubuntu OS 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 systems and will be automatically recognized as ttyACM0, ttyACM1, ttyACM2, and ttyACM3 upon 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 system and Ubuntu OS. 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 circuit board 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_57.jpg

0012_MPUUART_MP4232_58.jpg

0012_MPUUART_MP4232_59.jpg

0012_MPUUART_MP4232_62.jpg

0012_MPUUART_MP4232_60.jpg

III. Software Spec

We conducted tests using Raspberry Pi OS and Ubuntu systems. 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).

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

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

You can download the Raspberry Pi OS in:

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

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

Flash the system using a TF card

After flashing is complete, remove the TF card from the card reader and insert it into the TF card slot of the Raspberry Pi development board. Power it on to boot into the system.

IV. Work with Raspberry Pi OS

4.1 安装串口软件CuteCom

串口软件CuteCom的安装命令为:

sudo apt install cutecom

安装完毕后,点击桌面左上角的树莓派图标,在“System Tools”有CuteCom的快捷方式:

0012_MPUUART_MP4232_01.jpg

4.2 测试MP4232

MP4232扩展板的4个串口名称从上到下依次如下:

ttyACM3、ttyACM0、ttyACM1、ttyACM2

0012_MPUUART_MP4232_55.jpg

两个RS232串口之间的连接对应关系为:

R - T

G - G

T - R

在树莓派终端中输入lsusb,我们可以看到VL805和CH344Q:

0012_MPUUART_MP4232_03.jpg

输入ls /dev,我们可以看到4个串口ttyACM0、ttyACM1、ttyACM2、ttyACM3:

0012_MPUUART_MP4232_31.jpg

我们用串口连接线连接任意两个串口,使用CuteCom进行数据收发测试,经测试,树莓派系统下波特率最高可达到1.21M(以传输数据不发生乱码为准):

0012_MPUUART_MP4232_02.jpg

4.3 测试MPUUART

MPUUART扩展板的4个串口,靠上的两个为RS232串口(ttyACM0、ttyACM3),靠下的两个为RS485串口(ttyACM1、ttyACM2)。

0012_MPUUART_MP4232_56.jpg

两个RS485串口之间的连接对应关系为:

G - G

A - A

B - B

在树莓派终端中输入lsusb,我们可以看到VL805和CH344Q:

0012_MPUUART_MP4232_10.jpg

输入ls /dev,我们可以看到4个串口ttyACM0、ttyACM1、ttyACM2、ttyACM3:

0012_MPUUART_MP4232_32.jpg

我们用串口连接线连接两个RS232串口,使用CuteCom进行数据收发测试,经测试,树莓派系统下波特率最高可达到1.22M(以传输数据不发生乱码为准):

0012_MPUUART_MP4232_12.jpg

我们用串口连接线连接两个RS485串口,使用CuteCom进行数据收发测试,经测试,树莓派系统下波特率最高可达到2.02M(以传输数据不发生乱码为准):

0012_MPUUART_MP4232_13.jpg

4.4 测试4G模块

我司配套的CM4 4Gmini模块,在树莓派系统下均为免驱免拨号,自动识别,即插即用。4G型号分CM4 4G mini(CAT4 4G),高通4G,高通4G-GPS。

CAT4 4G版本在系统里识别成eth设备,高通4G在系统里识别成usb0设备。

4.4.1 模块连接

系统上电启动运行树莓派官方os后,在树莓派终端中执行命令lsusb,如下图所示:

0012_MPUUART_MP4232_41.jpg

0012_MPUUART_MP4232_42.jpg

在树莓派终端中执行ifconfig -a,我们可以看到4G模块(eth1或usb0)已经正确获得了IP地址:

0012_MPUUART_MP4232_39.jpg

0012_MPUUART_MP4232_40.jpg

如果此时看不到4G模块(eth1),请检查连线是否正确,以及使用lsusb命令查看模块是否被系统识别。

Statu LED灯状态如下:

CAT4 4G:

闪烁状态为1.8秒亮0.2秒灭(也可以通过亮的时间比灭的时间长来判断)表示4G模组已经联网。

闪烁状态是1.8秒灭0.2秒亮,说明SIM卡或者网络有问题,请检查SIM卡和天线。

高通4G:

闪烁状态为慢闪,中间有短暂快闪,表示4G模组已经联网;否则说明SIM卡或者网络有问题,请检查SIM卡和天线。

4G模组正确获得ip地址后,我们可以ping外网地址,如:

ping www.mcuzone.com

0012_MPUUART_MP4232_43.jpg

也可以通过4G模块连接外网,访问测速网站测速,结果如下:

0012_MPUUART_MP4232_44.jpg

注意:网络测速受网络环境和测试方法影响,速度请以实际为准,本测试仅供参考。

4.4.2 使用AT命令

以CAT4 4G为例,在树莓派终端中执行命令lsusb,如下图所示:

0012_MPUUART_MP4232_41.jpg

本模块的id为05c6 90b6,记录下这个值。

使用下列命令打开ttyUSB串口,其中echo后面的值就是之前记录的ID值:

sudo modprobe option

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

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

5002_CM5_Basic_60.jpg

安装minicom工具:

sudo apt-get install minicom

通过minicom打开AT命令串口:

sudo minicom -D /dev/ttyUSB1

(注意:使用哪个串口,应以在进入此串口后,可输入运行AT命令,显示不乱码,不乱跳结果为准)

如果需要查看回显,请键入命令:ate1,然后回车,继续键入其它命令,回车可以看到结果。

0012_MPUUART_MP4232_45.jpg

常用AT命令:

1. 检查SIM卡是否识别到:

at+cpin?

返回ready表示卡已识别,返回error要检查硬件

2. 检查天线信号质量:

at+csq

返回值在26-31表示信号OK,信号满格31;返回值在20-25表示信号勉勉强强;返回值在20以下表示信号比较糟糕或者天线没接

3. 检查注网情况:

at+cops?

正常应该返回运营商代码和7,7代表4G。

注意,以上命令只有at+csq不要加问号,另外两条命令需要加问号。

4. 查看4G模块的IMEI码:

at+cgsn

5. 重启4G模块(有时候如果重插SIM卡,热插拔不一定管用,可以用这个reset命令来复位模块):

at+reset

6. 关闭射频:

at+cfun=0

开启射频:

at+cfun=1

上述两条命令成对使用,可以在不重启4G模组的情况下让模组重新注网。

4.4.3 修改4G模组的IP地址

如果出厂默认的4G IP地址和用户使用的IP地址有冲突,或有修改IP地址的需求,可按照下列步骤进行修改:

CAT4 4G模块:

执行AT命令:

AT+ROUTEIP=<newip>

注意,只支持192.168.x.1这样格式的地址,如果设置了AT+ROUTEIP=192.168.3.1,最终获得的IP为192.168.3.100,修改完后需断电重启系统。

查询当前IP:AT+ROUTEIP?,返回两个值,前一个为旧IP,后一个为新IP。

测试命令:AT+ROUTEIP=?

高通 4G模块:

将4G模块的IP改为直接获取公网IP即可,请执行AT命令:

设置IP为公网:AT+GTIPPASS=1

设置IP为内网:AT+GTIPPASS=0

查询当前IP为公网还是内网:AT+GTIPPASS?

修改IP完毕后需要断电重启才能生效。

4.4.4 GPS测试(适用于高通4G-GPS版本)

如果你选择的是高通4G-GPS版本,则此4G附带GPS功能,需要接GPS无源天线,且确保GPS天线甩出户外。

输入命令lsusb,如下图所示:

0012_MPUUART_MP4232_46.jpg

记下4G模块的ID值:1508 1001

使用下列命令打开ttyUSB串口,其中echo后面的值就是上面记录的ID值:

sudo modprobe option

sudo sh -c 'echo 1508 1001 > /sys/bus/usb-serial/drivers/option1/new_id'

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

5002_CM5_Basic_60.jpg

运行minicom,打开ttyUSB1串口:

sudo minicom -D /dev/ttyUSB1

并运行:

AT+GTGPSPOWER=1 //打开GPS

运行成功后打开ttyUSB3:

sudo minicom -D /dev/ttyUSB3

就可以看到该串口有GPS信息输出,稍等片刻即可定位:

5002_CM5_Basic_61.jpg

五、Ubuntu系统的使用

5.1 安装串口软件CuteCom

串口软件CuteCom的安装命令为:

sudo apt install cutecom

安装完毕后,点击桌面左下角的“Show Apps”图标,有CuteCom的快捷方式:

0012_MPUUART_MP4232_05.jpg

但是如果在此直接打开CuteCom,有可能会出现Input框无法输入字符的问题,这是由于权限不足造成的,所以需要打开Ubuntu终端,输入:

sudo cutecom

0012_MPUUART_MP4232_06.jpg

来打开CuteCom,如果需要打开第二个CuteCom,则需要再开一个Ubuntu终端,输入打开CuteCom的命令。

5.2 测试MP4232

MP4232扩展板的4个232串口名称从上到下依次如下:

ttyACM3、ttyACM0、ttyACM1、ttyACM2

0012_MPUUART_MP4232_55.jpg

两个RS232串口之间的连接对应关系为:

R - T

G - G

T - R

在Ubuntu终端中输入lsusb,我们可以看到VL805和CH344Q:

0012_MPUUART_MP4232_07.jpg

输入ls /dev,我们可以看到4个串口ttyACM0、ttyACM1、ttyACM2、ttyACM3:

0012_MPUUART_MP4232_33.jpg

我们用串口连接线连接任意两个串口,使用CuteCom进行数据收发测试,经测试,Ubuntu系统下波特率最高可达到1.15M(以传输数据不发生乱码为准):

0012_MPUUART_MP4232_09.jpg

5.3 测试MPUUART

MPUUART扩展板的4个串口,靠上的两个为RS232串口(ttyACM0、ttyACM3),靠下的两个为RS485串口(ttyACM1、ttyACM2)。

0012_MPUUART_MP4232_56.jpg

两个RS485串口之间的连接对应关系为:

G - G

A - A

B - B

在Ubuntu终端中输入lsusb,我们可以看到VL805和CH344Q:

0012_MPUUART_MP4232_14.jpg

输入ls /dev,我们可以看到4个串口ttyACM0、ttyACM1、ttyACM2、ttyACM3:

0012_MPUUART_MP4232_34.jpg

我们用串口连接线连接两个RS232串口,使用CuteCom进行数据收发测试,经测试,树莓派系统下波特率最高可达到1.26M(以传输数据不发生乱码为准):

0012_MPUUART_MP4232_16.jpg

我们用串口连接线连接两个RS485串口,使用CuteCom进行数据收发测试,经测试,树莓派系统下波特率最高可达到1.98M(以传输数据不发生乱码为准):

0012_MPUUART_MP4232_17.jpg

联系我们

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

邮件:mcuzone@vip.qq.com

电话:13957118045

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

Copyright 2004-2025 野芯科技

T