1009 RPi0 DRS485 EN

来自Mcuzone Wiki

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 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).

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 systems, 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:

1009_RPi0_DRS485_01.jpg

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.

0007_Zero_4G_Cat1_41.jpg

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(两处必须确保加上)

0007_Zero_4G_Cat1_57.jpg

3.1.2 查看网络设备

打开树莓派OS的终端,输入命令ifconfig -a,如下图所示:

1009_RPi0_DRS485_02.jpg

3.2 测试网络设备

3.2.1 ping包测试

可以用-I参数指定从哪个网卡开始ping包,如下所示:

ping www.mcuzone.com -I eth0

ping www.mcuzone.com -I wlan0

1009_RPi0_DRS485_03.jpg

我们也可以通过关闭某个网卡,达到强制指定通过另一个网络进行通讯,如需关闭eth0,可执行下面的命令:

sudo ifconfig eth0 down

以及通过执行下面的命令来开启eth0:

sudo ifconfig eth0 up

3.2.3 iperf3测速

Windows版iperf3下载:

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

Linux下iperf3安装:

sudo apt-get install iperf3

百兆以太网测速结果,client模式92Mbps左右:

1009_RPi0_DRS485_04.jpg

server模式95Mbps左右:

1009_RPi0_DRS485_05.jpg

注意:USB转百兆有线网速受Zero 2W性能和USB Hub带宽占用影响,请以实际测速为准,本测速结果仅供参考。

3.3 双RS485串口测试

测试需要安装串口软件CuteCom,安装命令为:

sudo apt install cutecom

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

0012_MPUUART_MP4232_01.jpg

如果在使用过程中有权限不足的问题,请打开树莓派OS终端,输入:

sudo cutecom

来启动CuteCom。两个RS485接口,如下图:

3.3.1 RS485和PC数据收发测试

1009_RPi0_DRS485_21.jpg

测试ttyUSB0与PC之间的数据收发:

在PC端插上一个USB转485的转换器,与扩展板上的RS485接口(ttyUSB0)相连,各自打开串口软件进行收发,结果如下:

树莓派OS端/Windows端:

1009_RPi0_DRS485_07.jpg

经过实测,波特率最高可达到550kbps(以传输数据不发生乱码、缺失为准)。

测试ttyUSB1与PC之间的数据收发:

在PC端插上一个USB转485的转换器,与扩展板上的RS485接口(ttyUSB1)相连,各自打开串口软件进行收发,结果如下:

树莓派OS端/Windows端:

1009_RPi0_DRS485_08.jpg

经过实测,波特率最高可达到600kbps(以传输数据不发生乱码、缺失为准)。

3.2.2 两路RS485间数据收发测试

1009_RPi0_DRS485_20.jpg

扩展板上的两个RS485接口(ttyUSB0与ttyUSB1)相连,各自打开串口软件进行收发,结果如下:

ttyUSB0的树莓派OS端/ttyUSB1的树莓派OS端:

1009_RPi0_DRS485_09.jpg

经过实测,波特率最高可达到2.5Mbps(以传输数据不发生乱码、缺失为准)。

四、扩展板选型表

1006_RPi0_4G_MiniPCIe_64.jpg

联系我们

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

邮件:mcuzone@vip.qq.com

电话:13957118045

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

Copyright 2004-2025 野芯科技

T