1009 RPi0 DRS485 EN:修订间差异

来自Mcuzone Wiki
无编辑摘要
 
(未显示同一用户的9个中间版本)
第1行: 第1行:
[[1009 RPi0 DRS485|切换语言为中文]]
== '''Keywords''' ==
== '''Keywords''' ==
Raspberry Pi, Raspberry Pi Zero, Zero W, Zero WH, Zero 2W, USB2.0-A, Ethernet, Expansion Board, Dual RS485
Raspberry Pi, Raspberry Pi Zero, Zero W, Zero WH, Zero 2W, USB2.0-A, Ethernet, Expansion Board, Dual RS485
第12行: 第14行:
1. 2*gold-plated pogo pins are used for power supply and USB communication on the expansion board, respectively.
1. 2*gold-plated pogo pins are used for power supply and USB communication on the expansion board, respectively.


2. 1*USB-C power supply interface is provided, which can be used to power the system (in this case, the Raspberry Pi Zero's Micro USB power port doesn't need additional power supply). Alternatively, you can use the Micro USB power port on the Zero for power supply (choose one power supply method).
2. 1*USB-C power supply interface is provided, which can be used to power the OS (in this case, the Raspberry Pi Zero's Micro USB power port doesn't need additional power supply). Alternatively, you can use the Micro USB power port on the Zero for power supply (choose one power supply method).


3. 1*100M Ethernet port.
3. 1*100M Ethernet port.
第18行: 第20行:
4. 1*USB 2.0 Type-A port.
4. 1*USB 2.0 Type-A port.


5. 1*RS485 module, industrial grade, with power isolation
5. 1*RS485 module, industrial grade, with power isolation.


6. 尺寸:69*55mm;
6. Size: 69*55mm.


7. PCB板材通过UL和ROHS认证,防火等级94V-0;
7. The PCB material is UL and RoHS certified with a flammability rating of 94V-0.


注意1:连接了此扩展板后Zero上的MicroUSB将不可使用。
Note 1: The MicroUSB on the Zero will be unavailable after connecting this expansion board.


注意2:部分系统下需要禁用OTG功能并将USB模式设置为Host模式。
Note 2: On some OSs, it is necessary to disable the OTG function and set the USB mode to Host mode.


http://www.mcuzone.com/wiki/1009_RPi0_DRS485/1009_RPi0_DRS485_17.jpg
http://www.mcuzone.com/wiki/1009_RPi0_DRS485/1009_RPi0_DRS485_17.jpg
第34行: 第36行:
http://www.mcuzone.com/wiki/1009_RPi0_DRS485/1009_RPi0_DRS485_19.jpg
http://www.mcuzone.com/wiki/1009_RPi0_DRS485/1009_RPi0_DRS485_19.jpg


== '''三、树莓派OS的使用''' ==
== '''III. Work with Raspberry Pi OS''' ==
硬件平台:树莓派Zero 2W+扩展板;
Hardware: Raspberry Pi Zero 2W, RPi0 DRS485 expansion board
 
Software: The Raspberry Pi OS:(Raspberry Pi OS with desktop): 2024-07-04-raspios-bookworm-arm64.img.xz


软件平台:树莓派OS的版本为2024-07-04-raspios-bookworm-arm64.img.xz,树莓派OS下载地址:
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


(若使用树莓派Zero一代系列,只支持32位系统,请注意下载版本。)
(For Raspberry Pi Zero Gen 1 series, only 32-bit OS is supported. Please download the correct version.)


=== 3.1 查看硬件设备 ===
=== 3.1 View hardware devices ===


==== 3.1.1 查看USB设备 ====
==== 3.1.1 View USB devices ====
扩展板上的USB-A口接了无线键鼠,打开树莓派OS的终端,输入命令lsusb,如下图所示:
The USB-A port on the expansion board is connected to a wireless keyboard and mouse. Open the terminal, enter the command <code>lsusb</code>, as shown in the figure below:


http://www.mcuzone.com/wiki/1009_RPi0_DRS485/1009_RPi0_DRS485_01.jpg
<html><img src="http://www.mcuzone.com/wiki/1009_RPi0_DRS485/1009_RPi0_DRS485_01.jpg" width=640></html>


Device 006:百兆以太网;
Device 006: 100 Mbps Ethernet port.


Device 005/004:两路USB转RS485串口;
Device 005/004: 2*USB to RS485 serial ports.


Device 003:USB2.0-A接口(接无线键鼠);
Device 003: USB 2.0-A port (for wireless keyboard/mouse).


Device 002:外挂USB Hub。
Device 002: External USB Hub.


'''''注意,如果USB口不接设备,那lsusb里是不会出现相应的设备编号的。'''''
'''''Note: If no device is connected to the USB port, the corresponding device ID will not appear in the <code>lsusb</code> output.'''''


如果系统卡在树莓派logo处无法启动:
If the OS hangs on the Raspberry Pi logo and won't boot:


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_58.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_58.jpg


或者启动后键盘鼠标等无法使用,请仔细观察顶针是否对准了镀金触点,并请在PC端打开TF卡系统分区根目录下的config.txt检查USB的初始化脚本:
If the keyboard or mouse fails to work after startup, please carefully check whether the pogo pins are correctly positioned against the gold-plated contact points. Also, open the <code>config.txt</code> file in the root directory of the system partition on the TF card via a PC and verify the USB initialization script.


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_41.jpg
<html><img src="http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_41.jpg" style="border: 1px solid black;"></html>


需要确认下图中的三处红框的位置是否都配置成完全,如果没有,请手动添加完整并保存文件:
Please check if all three red-boxed areas in the image are fully configured. If not, manually complete them and save the file.


<code># otg_mode=1</code>(建议按此注释掉)
<code># otg_mode=1</code> (Recommended to comment out)


<code>dtoverlay=dwc2,dr_mode=host</code>(两处必须确保加上)
<code>dtoverlay=dwc2,dr_mode=host</code> (Must be added in both places)


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_57.jpg
<html><img src="http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_57.jpg" style="border: 1px solid black;"></html>


==== 3.1.2 查看网络设备 ====
==== 3.1.2 View network devices ====
打开树莓派OS的终端,输入命令<code>ifconfig -a</code>,如下图所示:
Open the terminal, enter the command <code>ifconfig</code>, as shown in the following image:


http://www.mcuzone.com/wiki/1009_RPi0_DRS485/1009_RPi0_DRS485_02.jpg
<html><img src="http://www.mcuzone.com/wiki/1009_RPi0_DRS485/1009_RPi0_DRS485_23.jpg" width=640></html>


=== 3.2 测试网络设备 ===
=== 3.2 Test network devices ===


==== 3.2.1 ping包测试 ====
==== 3.2.1 ping tests ====
可以用-I参数指定从哪个网卡开始ping包,如下所示:
Use the -I parameter to specify which network interface to start the ping packet from, as shown below:


<code>ping www.mcuzone.com -I eth0</code>
<code>ping www.mcuzone.com -I eth0</code>
第90行: 第94行:
<code>ping www.mcuzone.com -I wlan0</code>
<code>ping www.mcuzone.com -I wlan0</code>


http://www.mcuzone.com/wiki/1009_RPi0_DRS485/1009_RPi0_DRS485_03.jpg
<html><img src="http://www.mcuzone.com/wiki/1009_RPi0_DRS485/1009_RPi0_DRS485_03.jpg" width=640></html>


我们也可以通过关闭某个网卡,达到强制指定通过另一个网络进行通讯,如需关闭eth0,可执行下面的命令:
We can also force communication through another network by disabling a specific network card. For example, to disable eth0, you can execute the following command:


<code>sudo ifconfig eth0 down</code>
<code>sudo ifconfig eth0 down</code>


以及通过执行下面的命令来开启eth0:
And enable eth0 by the following command:


<code>sudo ifconfig eth0 up</code>
<code>sudo ifconfig eth0 up</code>


==== 3.2.3 iperf3测速 ====
==== 3.2.3 Test speed by iperf3 ====
Windows版iperf3下载:
You can download iperf3 (Windows version) in:


http://www.mcuzone.com/down/Software.asp?ID=10000634
http://www.mcuzone.com/down/Software.asp?ID=10000634


Linux下iperf3安装:
Install iperf3 (Linux version) by using the following command:


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


百兆以太网测速结果,client模式92Mbps左右:
100M Ethernet speed test results: It is about 92Mbps in client mode and it is about 95Mbps in server mode:
 
http://www.mcuzone.com/wiki/1009_RPi0_DRS485/1009_RPi0_DRS485_04.jpg


server模式95Mbps左右:
<html><img src="http://www.mcuzone.com/wiki/1009_RPi0_DRS485/1009_RPi0_DRS485_04.jpg" width=640></html>


http://www.mcuzone.com/wiki/1009_RPi0_DRS485/1009_RPi0_DRS485_05.jpg
<html><img src="http://www.mcuzone.com/wiki/1009_RPi0_DRS485/1009_RPi0_DRS485_05.jpg" width=640></html>


'''''注意:USB转百兆有线网速受Zero 2W性能和USB Hub带宽占用影响,请以实际测速为准,本测速结果仅供参考。'''''
'''''Note: The speed of the USB to 100M Ethernet is limited by the performance of the Zero 2W and the bandwidth usage of the USB Hub. Actual speeds may vary. This speed test result is for reference only.'''''


=== 3.3 双RS485串口测试 ===
=== 3.3 Dual RS485 Interface Test ===
测试需要安装串口软件CuteCom,安装命令为:
For the test, the serial port software CuteCom needs to be installed. The installation command is:


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


安装完毕后,点击桌面左上角的树莓派图标,在“System Tools”有CuteCom的快捷方式:
Once the installation is finished, click the Raspberry Pi icon at the top-left of the desktop, and the CuteCom shortcut can be found in "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


如果在使用过程中有权限不足的问题,请打开树莓派OS终端,输入:
If you encounter insufficient permissions during use, please open the terminal and enter the following shortcut:


<code>sudo cutecom</code>
<code>sudo cutecom</code>


来启动CuteCom。两个RS485接口,如下图:
Please start CuteCom later. Two RS485 interfaces, as shown in the figure below.


<html><img src="http://www.mcuzone.com/wiki/1009_RPi0_DRS485/1009_RPi0_DRS485_16.jpg" width=440></html>
<html><img src="http://www.mcuzone.com/wiki/1009_RPi0_DRS485/1009_RPi0_DRS485_16.jpg" width=440></html>


==== 3.3.1 RS485和PC数据收发测试 ====
==== 3.3.1 Testing data transfer between RS485 and PC ====
http://www.mcuzone.com/wiki/1009_RPi0_DRS485/1009_RPi0_DRS485_21.jpg
http://www.mcuzone.com/wiki/1009_RPi0_DRS485/1009_RPi0_DRS485_21.jpg


'''测试ttyUSB0与PC之间的数据收发:'''
'''Testing data transfer between ttyUSB0 and the PC:'''


在PC端插上一个USB转485的转换器,与扩展板上的RS485接口(ttyUSB0)相连,各自打开串口软件进行收发,结果如下:
On the PC side, plug in a USB-to-485 converter and connect it to the RS485 interface (ttyUSB0) on the expansion board. Then, open serial port software on both sides for sending and receiving data. The results are as follows:


树莓派OS端/Windows端:
Raspberry Pi OS/Windows:


http://www.mcuzone.com/wiki/1009_RPi0_DRS485/1009_RPi0_DRS485_07.jpg
http://www.mcuzone.com/wiki/1009_RPi0_DRS485/1009_RPi0_DRS485_07.jpg


经过实测,波特率最高可达到550kbps(以传输数据不发生乱码、缺失为准)。
Through actual testing, the maximum baud rate can reach 550kbps (based on the condition that no data corruption or loss occurs during transmission).


'''测试ttyUSB1与PC之间的数据收发:'''
'''Testing data transfer between ttyUSB1 and the PC:'''


在PC端插上一个USB转485的转换器,与扩展板上的RS485接口(ttyUSB1)相连,各自打开串口软件进行收发,结果如下:
On the PC side, plug in a USB-to-485 converter and connect it to the RS485 interface (ttyUSB1) on the expansion board. Then, open serial port software on both sides for sending and receiving data. The results are as follows:


树莓派OS端/Windows端:
Raspberry Pi OS/Windows:


http://www.mcuzone.com/wiki/1009_RPi0_DRS485/1009_RPi0_DRS485_08.jpg
http://www.mcuzone.com/wiki/1009_RPi0_DRS485/1009_RPi0_DRS485_08.jpg


经过实测,波特率最高可达到600kbps(以传输数据不发生乱码、缺失为准)。
Through actual testing, the maximum baud rate can reach 600kbps (based on the condition that no data corruption or loss occurs during transmission).


==== 3.2.2 两路RS485间数据收发测试 ====
==== 3.2.2 Testing data transfer between two RS485 ports ====
http://www.mcuzone.com/wiki/1009_RPi0_DRS485/1009_RPi0_DRS485_20.jpg
http://www.mcuzone.com/wiki/1009_RPi0_DRS485/1009_RPi0_DRS485_20.jpg


扩展板上的两个RS485接口(ttyUSB0与ttyUSB1)相连,各自打开串口软件进行收发,结果如下:
Connect the two RS485 ports (ttyUSB0 and ttyUSB1) on the expansion board, open serial port software on each for sending and receiving, with the following results:


ttyUSB0的树莓派OS端/ttyUSB1的树莓派OS端:
Raspberry Pi OS(ttyUSB0)/Raspberry Pi OS(ttyUSB1):


http://www.mcuzone.com/wiki/1009_RPi0_DRS485/1009_RPi0_DRS485_09.jpg
http://www.mcuzone.com/wiki/1009_RPi0_DRS485/1009_RPi0_DRS485_09.jpg


经过实测,波特率最高可达到2.5Mbps(以传输数据不发生乱码、缺失为准)。
Through actual testing, the maximum baud rate can reach 2.5Mbps (based on the condition that no data corruption or loss occurs during transmission).
 
== '''四、扩展板选型表''' ==
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_64.jpg


{{联系我们_图标}}
== '''IV. Expansion board selection guide''' ==
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_65.jpg


[http://wiki.mcuzone.com/index.php?title=1009_RPi0_DRS485 T]
{{Contact_Us_icon}}

2025年4月14日 (一) 16:02的最新版本

切换语言为中文

Keywords

Raspberry Pi, Raspberry Pi Zero, Zero W, Zero WH, Zero 2W, USB2.0-A, Ethernet, Expansion Board, Dual RS485

I. Introduction

This expansion board is based on the Raspberry Pi Zero series development board. Utilizing the USB and power contacts on the reverse side of the Zero, it connects to the Zero via gold-plated pogo pins, expanding two RS485 interfaces, one 100M Ethernet port, and one USB 2.0 port. The expansion board acts as a USB hub, using the Zero's native USB port as a host. Thus, the Raspberry Pi Zero's built-in USB port cannot support additional external devices. The entire system is powered via USB-C, requiring no additional power for the Raspberry Pi Zero, and without occupying the 40-pin GPIO port of the Zero.

The expansion board supports the full range of Raspberry Pi Zero series development boards, including the Zero, Zero W, Zero WH, and Zero 2W.

The RS845 module is industrial-grade with power isolation, supporting speeds up to 600Kbps and 64 nodes.

II. Hardware Spec

1. 2*gold-plated pogo pins are used for power supply and USB communication on the expansion board, respectively.

2. 1*USB-C power supply interface is provided, which can be used to power the OS (in this case, the Raspberry Pi Zero's Micro USB power port doesn't need additional power supply). Alternatively, you can use the Micro USB power port on the Zero for power supply (choose one power supply method).

3. 1*100M Ethernet port.

4. 1*USB 2.0 Type-A port.

5. 1*RS485 module, industrial grade, with power isolation.

6. Size: 69*55mm.

7. The PCB material is UL and RoHS certified with a flammability rating of 94V-0.

Note 1: The MicroUSB on the Zero will be unavailable after connecting this expansion board.

Note 2: On some OSs, it is necessary to disable the OTG function and set the USB mode to Host mode.

1009_RPi0_DRS485_17.jpg

1009_RPi0_DRS485_18.jpg

1009_RPi0_DRS485_19.jpg

III. Work with Raspberry Pi OS

Hardware: Raspberry Pi Zero 2W, RPi0 DRS485 expansion board

Software: The Raspberry Pi OS:(Raspberry Pi OS with desktop): 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

(For Raspberry Pi Zero Gen 1 series, only 32-bit OS is supported. Please download the correct version.)

3.1 View hardware devices

3.1.1 View USB devices

The USB-A port on the expansion board is connected to a wireless keyboard and mouse. Open the terminal, enter the command lsusb, as shown in the figure below:

Device 006: 100 Mbps Ethernet port.

Device 005/004: 2*USB to RS485 serial ports.

Device 003: USB 2.0-A port (for wireless keyboard/mouse).

Device 002: External USB Hub.

Note: If no device is connected to the USB port, the corresponding device ID will not appear in the lsusb output.

If the OS hangs on the Raspberry Pi logo and won't boot:

0007_Zero_4G_Cat1_58.jpg

If the keyboard or mouse fails to work after startup, please carefully check whether the pogo pins are correctly positioned against the gold-plated contact points. Also, open the config.txt file in the root directory of the system partition on the TF card via a PC and verify the USB initialization script.

Please check if all three red-boxed areas in the image are fully configured. If not, manually complete them and save the file.

# otg_mode=1 (Recommended to comment out)

dtoverlay=dwc2,dr_mode=host (Must be added in both places)

3.1.2 View network devices

Open the terminal, enter the command ifconfig, as shown in the following image:

3.2 Test network devices

3.2.1 ping tests

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 wlan0

We can also force communication through another network by disabling a specific network card. For example, to disable eth0, you can execute the following command:

sudo ifconfig eth0 down

And enable eth0 by the following command:

sudo ifconfig eth0 up

3.2.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 92Mbps in client mode and it is about 95Mbps in server mode:

Note: The speed of the USB to 100M Ethernet is limited by the performance of the Zero 2W and the bandwidth usage of the USB Hub. Actual speeds may vary. This speed test result is for reference only.

3.3 Dual RS485 Interface Test

For the test, the serial port software CuteCom needs to be installed. The installation command is:

sudo apt install cutecom

Once the installation is finished, click the Raspberry Pi icon at the top-left of the desktop, and the CuteCom shortcut can be found in "System Tools".

0012_MPUUART_MP4232_01.jpg

If you encounter insufficient permissions during use, please open the terminal and enter the following shortcut:

sudo cutecom

Please start CuteCom later. Two RS485 interfaces, as shown in the figure below.

3.3.1 Testing data transfer between RS485 and PC

1009_RPi0_DRS485_21.jpg

Testing data transfer between ttyUSB0 and the PC:

On the PC side, plug in a USB-to-485 converter and connect it to the RS485 interface (ttyUSB0) on the expansion board. Then, open serial port software on both sides for sending and receiving data. The results are as follows:

Raspberry Pi OS/Windows:

1009_RPi0_DRS485_07.jpg

Through actual testing, the maximum baud rate can reach 550kbps (based on the condition that no data corruption or loss occurs during transmission).

Testing data transfer between ttyUSB1 and the PC:

On the PC side, plug in a USB-to-485 converter and connect it to the RS485 interface (ttyUSB1) on the expansion board. Then, open serial port software on both sides for sending and receiving data. The results are as follows:

Raspberry Pi OS/Windows:

1009_RPi0_DRS485_08.jpg

Through actual testing, the maximum baud rate can reach 600kbps (based on the condition that no data corruption or loss occurs during transmission).

3.2.2 Testing data transfer between two RS485 ports

1009_RPi0_DRS485_20.jpg

Connect the two RS485 ports (ttyUSB0 and ttyUSB1) on the expansion board, open serial port software on each for sending and receiving, with the following results:

Raspberry Pi OS(ttyUSB0)/Raspberry Pi OS(ttyUSB1):

1009_RPi0_DRS485_09.jpg

Through actual testing, the maximum baud rate can reach 2.5Mbps (based on the condition that no data corruption or loss occurs during transmission).

IV. Expansion board selection guide

1006_RPi0_4G_MiniPCIe_65.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