Thursday, November 21, 2024

NVMe on Raspberry Pi 5

Raspberry Pi 5 introduced a PCIe connector in the place of the under-utilized display connector.  Now it is possible to use an NVMe SSD.  It would require a PCIe to NVMe adapter, which can be purchased for about $7 and comes with a board to mount an M.2 M-key NVMe SSD for size 2230/2242/2280 and a flexible flat cable to connect to RPi 5.  
Download the OS image.  xzcat pipe to dd to the disk.  Two partitions are created and take up about 14GB.

The default EEPROM `BOOT_ORDER=0xf416`, the boot order should be NVMe, SD Card, USB.  But it still boots the SD card first.  With the SD card out, the RPi 5 boots from the NVMe.  The root partition is near full.  Use resizepart and resize2fs to grow the root file system and it is OK is to resize at runtime.

A sustained read/write speed is 390MB/s read and 440MB/s write, which is better than the USB NVMe adapter 260MB/s read and 380MB/s write, but not dramatically.

The RPi 5 PCIe is rated for Gen 2 one-lane; the maximum throughput is 500MB/s.  

In config.txt, add `dtparam=pciex1_gen=3` to enables PCIe Gen 3 (1GB/s).  The reliability of the Gen 3 operation is not guaranteed, but it appears to work well.  The read speed is increased to 850 MB/s; the write speed is largely unchanged.  The disk is rated at up to 1700MB/s for sequential read and up to 1000MB/s for sequential write.

The board averages about 1.2A/5V during writing.  

The PCIe interface appears to have some interference on the WiFi signal.  The on-board WiFi has trouble picking up relatively weak signals.  Other people have reported similar issue.  The WiFi does work when it is close to the router.