0005 MPS2242 2280 2280P(Single SSD Expansion Board)

来自Mcuzone Wiki

Keywords

Raspberry Pi 5, 2230, 2242, 2280, Pi OS, Ubuntu, NVMe SSD, PCIe, SSD X1, Gen2, Gen3, AI、HAILO 8L, Camera, OV5647, Image Detection, Image Recognition

I. Introduction

The MPS2242 and MPS2280 are SSD expansion boards designed for the Raspberry Pi 5 that support the NVMe protocol. The difference between the two is that they support SSDs of different sizes: the MPS2242 supports 2242-sized SSDs, and the MPS2280 supports 2280-sized SSDs. The system can boot from the SSD, or it can boot from the TF card while using the SSD solely for storage purposes.

II. Hardware Resources

2.1 There are two versions: one for 2242 and one for 2280, the installation position is on the HAT, and both supporting NVMe protocol SSDs. Note: SSD that use the NGFF and SATA protocols are not supported.

The MPS2242 supports 2230/2242 size SSDs (defaulting to welded mounting posts for 2242 size).

The MPS2280 supports 2230/2242/2280 size SSDs (defaulting to welded mounting posts for 2280 size).

2.2 It uses a 0.5mm pitch 16-pin PCIe 2.0 x1 interface for connection.

2.3 It uses a 1.5A high-efficiency DC-DC circuit, which can support most SSDs (however, due to the x1 interface, the actual peak power consumption of the SSD is only one-third of its rated power consumption).

2.4 One 5V power indicator light and one hard drive activity status indicator light.

2.5 It features an indented slot design, with no obstruction above the 40-pin connector, ensuring that DuPont cable connections are not affected.

2.6 Reserve CSI/DSI cable slots.

0005_MPS2242_2280_60.jpg

0005_MPS2242_2280_61.jpg

On the Raspberry Pi side:

0005_MPS2242_2280_27.jpg

0005_MPS2242_2280_62.jpg

III. System flashing and setting

3.1 Overview

This document uses the Raspberry Pi OS and Ubuntu system for testing.

The version of the Raspberry Pi OS is: 2024-07-04-raspios-bookworm-arm64.img.xz,

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://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-64-bit

You can download the Ubuntu system in:

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

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 5;

Operating System:

Choose Raspberry Pi OS(64-bit), to flash the system image downloaded from the Raspberry Pi official website (internet connection required).

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

0005_MPS2242_2280_01.jpg

After making your selection, press "NEXT." It is recommended to click "Edit Settings" to pre-set some parameters in the flashing software. This way, you won't need to set them again when the system starts up, making it easier to use.

0005_MPS2242_2280_02.jpg

0005_MPS2242_2280_03.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.

0005_MPS2242_2280_04.jpg

The above instructions describe how to flash the Raspberry Pi OS. For flashing the Ubuntu system or the OpenWrt system, similar operations are used; when you reach the step "Operating System", you need to select Use Custom, and then choose the pre-downloaded image.

3.2.2 Use the balenaEtcher to flash the system

First, 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 Ubuntu system 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.

0005_MPS2242_2280_05.jpg

3.2.3 Boot the system

Remove the TF card from the card reader, insert it into the TF card slot of the Raspberry Pi, and power the board on to enter the system.

3.3 Boot from SSD

The Raspberry Pi only supports SSDs with PCIe NVMe protocol interface.

3.3.1 Flash the Raspberry Pi OS image onto the TF card, and then boot the Raspberry Pi OS from the TF card.

3.3.2 Set the boot order and enable the SSD. Open the terminal on the Raspberry Pi OS, enter sudo rpi-eeprom-config --edit, and modify the BOOT_ORDER to:

BOOT_ORDER=0xf416

Modify or add PCIE_PROBE to:

PCIE_PROBE=1

Then press Ctrl+X, save and exit, and reboot.

Note 1: This file is saved in the E2PROM of the Raspberry Pi board after editing. Therefore, if you do not change the Raspberry Pi board and only change the system, you do not need to edit it again.

Note 2: The factory settings of the Raspberry Pi 5 vary depending on the shipment period; those shipped in 2024 have already enabled SSD booting.

0005_MPS2242_2280_06.jpg

0005_MPS2242_2280_07.jpg

The explanation for the boot order is as follows: [1]

MPS2280iPoE_24.png

The BOOT_ORDER=0xf416 indicates the boot order is NVMe (SSD), SD (TF) card, and USB drive. You can set the boot order according to your own requirements.

3.3.3 Insert the SSD into an M.2 (PCIe NVMe protocol) to USB adapter, connect it to the PC, and use the same method as flashing an image to a TF card to flash the system image onto the SSD. Then remove the SSD, plug it back into the expansion board, and power on the system (you can remove the TF card originally used to boot the system).

3.3.4 Another method of flashing is to do it directly in the Raspberry Pi OS. You will need to prepare a USB drive and copy the Raspberry Pi OS image onto the USB drive. Set the boot order with the SD (TF) card as the first priority and the NVMe (SSD) as the second priority. Then insert the TF card with the installed system, the USB drive containing the Raspberry Pi OS installation image, and the SSD that needs to be flashed into the board.

Boot the system; at this time, the system boots from the TF card. The latest Raspberry Pi OS includes Imager. If Imager is not included in your Raspberry Pi OS, you can install it using the following command:

sudo apt install rpi-imager

Open it in the GUI:

MPS2280iPoE_25.png

MPS2280iPoE_26.png

3.3.7 In the flashing interface, select the device, OS, and storage, and start the flashing process. Note that the storage should be set to SSD at this point and not a USB drive.

MPS2280iPoE_27.png

During the flashing process, a prompt to enter a password will appear twice. Please enter the system login password. After the flashing process is complete, shut down the system, remove the TF card and USB drive, and restart again, it will boot from the SSD.

MPS2280iPoE_28.png

MPS2280iPoE_29.png

MPS2280iPoE_30.png

IV. Demonstration of using the Raspberry Pi OS

4.1 Use the SSD for storage expansion.

4.1.1 Set the Raspberry Pi to boot from the TF card, insert an SSD hard drive into the M.2 slot on the expansion board, and boot the Raspberry Pi OS from the TF card.

4.1.2 In the Raspberry Pi OS, open the File Manager, and we can see the partitions of the SSD. As shown in the following figure:

0005_MPS2242_2280_08.jpg

If you need to operate on the SSD, click on the partition icon. At this point, you need to enter the system password and then click "Authenticate." After successful authorization, you can proceed to operate on the SSD:

0005_MPS2242_2280_09.jpg

When you return to the desktop, you can see the shortcut icon for the SSD partition:

0005_MPS2242_2280_10.jpg

At the same time, by entering df in the terminal, we can also see the SSD partitions, and we can use this SSD as a storage device.

0005_MPS2242_2280_11.jpg

4.2 Use the SSD for system boot

4.2.1 Flash the Raspberry Pi OS onto the SSD, then remove the TF card, or in the boot order settings, set booting from NVMe (SSD) as the first priority.

4.2.2 Insert the SSD with the flashed system into the M.2 slot on the expansion board, and boot the Raspberry Pi OS.

4.2.3 Open the File Manager, and we can see that the remaining space displayed in the lower right corner is 106.3GB (the total capacity of this SSD is 120GB). At the same time, by entering `df` in the terminal, you can also see that the SSD is divided into two partitions, with nvme0n1p1 used as the system partition and nvme0n1p2 used as the storage partition.

0005_MPS2242_2280_12.jpg

0005_MPS2242_2280_13.jpg

V. Demonstration of using the Ubuntu system

5.1 SSD用作存储扩展

5.1.1 把树莓派开发板设置为从TF卡启动,将一块SSD硬盘插入扩展板的SSD M.2接口,从TF卡启动Ubuntu系统。

5.1.2 在Ubuntu系统中,与树莓派OS不同的是,我们不需要输入系统密码就可以对SSD进行操作。我们进入Files,点击Other Locations,可以看到SSD的分区(500GB Volume,挂载到/dev/nvme0n1p1)。如下图所示:

0005_MPS2242_2280_14.jpg

注意:如果要在终端中对SSD硬盘进行操作,必须按照上面的步骤先进一次SSD文件夹。

5.1.3 同时在桌面,也可以看到SSD分区的快捷图标:

0005_MPS2242_2280_15.jpg

在终端中输入lsblk,也可以看到这个SSD分区,我们可以将这个SSD作为存储设备。

0005_MPS2242_2280_16.jpg

5.2 SSD用于系统启动

5.2.1 将Ubuntu系统烧写进SSD硬盘,然后拔掉TF卡,或者在启动顺序设置中,把从NVMe(SSD)启动设置成第一位。

5.2.2 将烧写好系统的进SSD硬盘插入扩展板的SSD M.2接口,启动Ubuntu系统。

5.2.3 我们进入Files,点击Other Locations,可以看到SSD的分区。在终端中输入df,可以看到SSD被分成了两个分区,nvme0n1p1被用作系统分区,nvme0n1p2被用作存储分区。

0005_MPS2242_2280_17.jpg

0005_MPS2242_2280_18.jpg

六、对SSD进行分区等操作

6.1 概述

本章以树莓派OS为例,介绍对安装在MPS2242/2280的SSD进行分区、挂载等操作。

6.2 使用GParted软件对SSD进行分区

6.2.1 下载GParted软件。打开树莓派OS终端,输入以下命令,安装GParted软件。

sudo apt install gparted

MPS2280D_77.jpg

6.2.2 打开GParted软件,选择相应SSD。

打开GParted软件的命令是sudo gparted,打开后为图形化界面,我们在右上角的下拉菜单中选择SSD。

MPS2280D_23.jpg

MPS2280D_24.jpg

6.2.3 在对SSD进行分区前,首先要对该分区进行取消原来的挂载,在该分区上点右键,选择“Unmount”,取消挂载后,再次在此分区上点右键,选择“Delete”,删除分区。本SSD上有两个分区,对另一个分区也是如此操作。

MPS2280D_25.jpg

MPS2280D_26.jpg

6.2.4 删除分区完毕后,我们在菜单中选择“Edit - Apply All Operations”,接受上述所有的操作。GParted类似于DiskGenius,在没有Apply之前,是不会对分区进行真实的操作的。

MPS2280D_27.jpg

MPS2280D_28.jpg

MPS2280D_29.jpg

6.2.5 然后在空白的SSD上点击右键,选择“New”,建立新分区,在这里我们建立了两个分区,格式为exfat,操作如下所示。

MPS2280D_30.jpg

MPS2280D_31.jpg

MPS2280D_32.jpg

MPS2280D_33.jpg

MPS2280D_34.jpg

MPS2280D_35.jpg

MPS2280D_36.jpg

这样我们就完成了对SSD的分区。

6.3 挂载分区

6.3.1 此时SSD已经分为了两个区,这两个区可以在Windows下进行操作,但Linux和Windows不一样,需要对新建的分区进行挂载,挂载完毕后才能操作。我们首先用命令lsblk查看分区信息,可见新建的两个分区,名字分别为nvme0n1p1和nvme0n1p2。

MPS2280D_37.jpg

然后我们依次输入以下命令,建立挂载点:

sudo mkdir /ssd1

sudo mkdir /ssd2

6.3.2 查看分区UUID,我们在树莓派终端中输入命令sudo blkid,如图所示,两个SSD分区的UUID分别是769F-F2E1和77F0-F2E1,将这两个值记录下来。

MPS2280D_38.jpg

6.3.3 在树莓派终端中输入命令sudo nano /etc/fstab,在文件的末尾加入两行代码:

UUID=769F-F2E1 /ssd1 exfat defaults,umask=000,gid=1000 0 2

UUID=77F0-F2E1 /ssd2 exfat defaults,umask=000,gid=1000 0 2

MPS2280D_39.jpg

MPS2280D_40.jpg

保存后退出,然后重启系统,在树莓派终端中输入lsblk,可以看见nvme0n1p1和nvme0n1p2分别被挂载到ssd1和ssd2下。

MPS2280D_42.jpg

此时我们也可以在文件目录的根目录下看到ssd1和ssd2两个目录,分别代表SSD上的两个分区,我们可以对这两个文件夹进行操作,这样就完成了分区的挂载。

MPS2280D_41.jpg

七、使用hdparm对SSD硬盘进行测速

7.1 概述

树莓派5支持系统运行在 PCIe Gen2和 PCIe Gen3两种模式下,本章以树莓派OS为例,分别测试在PCIe Gen2和 PCIe Gen3两种模式下,SSD硬盘的运行速度。

7.2 在PCIe Gen2下测试硬盘速度

7.2.1 树莓派OS的默认配置是运行在PCIe Gen2下的,因此这里不需要改变系统配置。

7.2.2 安装硬盘测速软件hdparm。在树莓派终端下运行:

sudo apt install hdparm

0004_MPS2280Bi_05.jpg

7.3.3 在树莓派终端下运行df,查看SSD分区名为nvme0n1p1:

0005_MPS2242_2280_19.jpg

运行命令,可多次运行,测试多次硬盘速度:

sudo hdparm -t /dev/nvme0n1p1

0005_MPS2242_2280_20.jpg

可见此测试硬盘在PCIe Gen2下的运行速度为450MB/s左右。

7.3 在PCIe Gen3下测试硬盘速度

7.3.1 在树莓派终端中输入sudo nano /boot/firmware/config.txt,在最后一行加入下列代码:

dtparam=pciex1_gen=3

0004_MPS2280Bi_02.jpg

0004_MPS2280Bi_03.jpg

保存后退出并重启系统,这样就切换到了PCIe Gen3。

7.3.2 使用上节介绍的方法,运行命令,可多次运行,测试多次硬盘速度:

sudo hdparm -t /dev/nvme0n1p1

0005_MPS2242_2280_21.jpg

可见此测试硬盘在PCIe Gen3下的运行速度为880MB/s左右。

7.4 结论

PCIe Gen2的理论带宽是5Gbps,PCIe Gen3的理论带宽是8Gbps。对比PCIe Gen3下和PCIe Gen2下的测试结果,可见在PCIe Gen3下,因为带宽的影响,SSD硬盘的运行速度有所提高。

注意:硬盘运行速度受硬盘质量、硬盘上的文件存储情况等多种因素影响,以上测试结果仅供参考,不作为实际产品的最终参数。

八、Ai模块(HAILO 8L)在MPS2242上的使用演示

8.1 概述

在各种实际应用的场合中,人们对于摄像头图像检测识别的需求逐渐增加,市面上也有许多利用AI的解决方案,本文所演示的方案是树莓派5搭配OV5647摄像头、MPS2242和HAILO 8L AI模块在树莓派5上的使用演示

此操作演示同时也适用于我们司所有树莓派5的SSD相关的PCIE转接板,包括MPS2242-POE、MPS2280、MPS2280P、MPS2280Bi、MPS2280-POE、MPS2280D、MPS2.5G、MPSAI、MPSD2.5GD等。

(另外我司树莓派CM4扩展板上其它带CSI接口+M.2 SSD接口的板子均可使用,如CM4_SSD扩展板、CM4_3PCIE扩展板、CM4_Ultra扩展板、CM4_SSD+WiFi扩展板、CM4_SSD+双以太网、CM4_NAS等。)

0005_MPS2242_2280_44.jpg

注意:此操作演示需要确保能稳定连通外网(需自备方法),否则许多文件无法下载或下载不全,最后可能会造成代码运行失败。

8.2 更新系统

8.2.1 启动树莓派OS,在终端中执行:

sudo apt update

sudo apt full-upgrade

0005_MPS2242_2280_28.jpg

0005_MPS2242_2280_29.jpg

8.2.2 执行sudo rpi-eeprom-update,查看树莓派固件,确保树莓派的固件日期在2023年12月6日之后:

0005_MPS2242_2280_30.jpg

如上图所示,固件时间是2024年6月5日。

8.2.3 执行sudo raspi-config,根据下图依次选择对应选项:

0005_MPS2242_2280_31.jpg

0005_MPS2242_2280_32.jpg

0005_MPS2242_2280_33.jpg

0005_MPS2242_2280_34.jpg

0005_MPS2242_2280_35.jpg

0005_MPS2242_2280_36.jpg

选择完之后退出,系统会自动重启,如果没有自动重启,请手动执行 sudo reboot ,重启系统。

8.3 AI模块所需要的依赖安装

执行sudo apt install hailo-all,安装AI模块所需要的依赖安装:

0005_MPS2242_2280_37.jpg

0005_MPS2242_2280_38.jpg

完成后执行 sudo reboot ,重启系统,使这些设置生效。

执行hailortcli fw-control identify,如果出现以下输出则成功安装了HAILO 8L的依赖:

0005_MPS2242_2280_39.jpg

最后再执行rpicam-hello -t 10s,打开摄像头并出现预览窗口,确定摄像头正常。

0005_MPS2242_2280_40.jpg

8.4 图像识别检测

执行:

git clone --depth 1 https://github.com/raspberrypi/rpicam-apps.git ~/rpicam-apps

克隆rpicam-apps库:

0005_MPS2242_2280_41.jpg

克隆完成后,就可以开始进行图像的识别检测:

rpicam-hello -t 0 --post-process-file ~/rpicam-apps/assets/hailo_yolov6_inference.json --lores-width 640 --lores-height 640

0005_MPS2242_2280_42.jpg

0005_MPS2242_2280_43.jpg

鉴于本开发板的测试需要在外网下载大量数据,为了方便用户进行测试,用户在购买本开发板后,可以联系我司获取已经配置完毕的树莓派OS镜像。

九、应用选配

MPS2280 HAT有3个固定孔,此固定孔可以适配我们是一些CM4尺寸的功能模块,比如CM4 4G mini、CM4 CAT1 4G、CM4 GPS、CM4温湿度模块、CM4 4G语音模块,还有5V5A电源和5V5A PD电源等,而且可以多个叠加组装使用。

MPS2242也有可以利用2个固定孔来组装CM4 4G mini模块。

0005_MPS2242_2280_59.jpg

联系我们

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

邮件:mcuzone@vip.qq.com

电话:13957118045

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

Copyright 2004-2024 野芯科技

  1. 1