PCIe TO M.2 HAT+

From Waveshare Wiki
Jump to: navigation, search
PCIe TO M.2 HAT+
PCIe TO M.2 HAT+.jpg

PCIe TO M.2
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

Overview

Introduction

PCIe to M.2 M key adapter board for Raspberry Pi 5, compatible with M.2 drives in 2230 / 2242 size, supports Gen2 and Gen3 modes, supports booting from SSD for PI5.

Video

  • Assembly and usage tutorial:

Features

  • Support NVMe protocol M.2 solid state drive, high-speed read/write, with high work efficiency.
  • PCI-E×1 Gen2 or Gen3 mode.
  • Only supports PI5B.
  • Compatible with M.2 solid state drive of 2230/2242 sizes.
  • Onboard working indicator lights, with PWR on continuously when powered, and ACT blinking during read/write, making the operating status clear at a glance.
  • HAT+ design, with on-board EEPROM chip.
  • Onboard power monitoring chip, for real-time monitoring of the working status of the solid-state drive.
  • Reserved airflow vent for PI5 fans, increasing airflow, and reducing solid-state temperatures.

Hardware Description

Hardware Connection

Pay attention to the direction of the cable and connect it as shown in the figure:
PCIe-TO-M.2-HAT-Plus-details-2.jpg

Load

1: Enable PCIe Interface:

The PCIe interface is not enabled by default on PI5B. To enable it, add the following configuration in /boot/firmware/config.txt:
The PI5B does not have the PCIE interface enabled by default, add it in /boot/firmware/config.txt:
dtparam=pciex1

2: PCIE is gen2 by default, if you need to enable PCIE gen3, add it in /boot/firmware/config.txt:

dtparam=pciex1_gen=3

3: After modifying it and restarting PI5, you can recognize the device.

As shown below, the identified SM2263 is my SSD, and the other PI5 is the RPI chip.  
PCIe TO M.2 HAT+ W 1.png

4: Note that skip this step if you have partitioned and formatted on other platforms (will delete all data from the SSD and proceed with caution).

lsblk  for viewing the disk (If you want to see the details run sudo fdisk -l) 
PCIe TO M.2 HAT+ W 2.png
Partition
sudo fdisk /dev/nvme0n1    The device number is the total device number, don't add p1, that's just one partition
How to use fdisk partition tool
n New Partition
q Exit without saving
p Print partition table
m Print selection menu
d Delete Partition
w Save to exit
t Modify ID number
Add the partition to execute n can be, the last w save exit

5: Format:

sudo mkfs.  Then press the tab to see a variety of different suffixes, the different suffixes are the formats you need to format.
PCIe TO M.2 HAT+ W 3.png
If I want to format to the ext4 file format, this would be done by executing the following command:
sudo mkfs.ext4 /dev/nvme0n1p1
Wait for a few moments, when done has appeared, it means that the formatting has been carried out.
PCIe TO M.2 HAT+ W 4.png

6: Mount:

Create Mount Directory
sudo mkdir toshiba
Mount the device
sudo mount /dev/nvme0n1p1 ./toshiba
Checking disk status
df -h

Read/Write Test

Enter the directory where the disk is mounted:

cd toshiba
  • Release memory:
sudo sh -c "sync && echo 3 > /proc/sys/vm/drop_caches"
  • Copying the contents of the Raspberry Pi's memory to the hard drive (Write):
sudo dd if=/dev/zero of=./test_write count=2000 bs=1024k

PCIe TO M.2 HAT+ W 5.png

  • Copying the contents of the hard drive's memory to the Raspberry Pi (Write):
 sudo dd if=./test_write of=/dev/null count=2000 bs=1024k

Pcie-m2-6new.png

  • Note: Different cards and environments have different test results. As the Raspberry Pi is more vulnerable to being affected, if you want to test the exact performance, you can use a PC to test.

Auto-mounting

If the testing is sound and you don't need it as a system disk and only use it as an extended disk, you can set up an automatic mounting:

sudo nano /etc/fstab

#Add the following content at the end:
/dev/nvme0n1p1  /home/pi/toshiba  ext4  defaults  0  0
#/dev/nvme0n1p1 is the device name, /home/pi/toshiba is the directory to be mounted, ext4 is the file system type, defaults are using the default mounting setting
#Make the changes take effect (test without problems before rebooting, otherwise it will lead to failure to mount or boot)
sudo mount -a

#And then reboot  
Check the device through "lsblk" 

NVMe SSD Booting

1: Start the Raspberry Pi using the SD card, mount, and test to ensure that the hardware is functioning properly.
2: Boot the Raspberry Pi using the SD card and modify the boot settings by changing the BOOT_ORDER configuration in the Raspberry Pi's bootloader.

sudo rpi-eeprom-config --edit 
Modify BOOT_ORDER=0xf41 as BOOT_ORDER=0xf416
PCIe TO M.2 HAT+ W 6.png
For details, please refer to BOOT_ORDER 

3: Reboot the Raspberry Pi and look at the serial port logs during boot up to see that:

PCIe TO M.2 HAT+ W 7.png
This indicates that the modification was successful.
If you find that you can't modify the file several times, please connect to the network before modifying the file (wait for the network to time itself), or set the correct time before modifying the file.

4: Just program the system into NVME, then connect the board, remove the SD card, and re-power it up.

NVME Power Monitoring

Onboard the INA219 chip for detecting the voltage and current, easy to monitor the device status and monitor the input 5V voltage status (not 3.3V).
The default I2C address is 0x40, addresses can be modified via back resistors to support stacking of different expansion boards.

Demo:

wget https://files.waveshare.com/wiki/PCIe-TO-M.2-HAT%2B/PCIe_TO_M.2_HAT%2B.zip
unzip -o PCIe_TO_M.2_HAT+.zip -d ./PCIe_TO_M.2_HAT+
cd PCIe_TO_M.2_HAT+
sudo python INA219.py
PCIe TO M.2 HAT+ W 8.png

Resource

Datasheet

FAQ

 Answer:

I'm sorry that it cannot fit the original case.

{{{5}}}


 Answer:

The PCIe TO M.2 HAT+ connectors are 4 on one side and 5 on the other.
PCIe TO M.2 HAT+ faq.png

{{{5}}}


Support



Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)