sudo nano /boot/firmware/config.txt
Then add the following comment;
# Enable the PCIe External connector.
dtparam=pciex1
<!--
# This line is an alias for above (you can use either/or to enable the port).
dtparam=nvme
-->
Press '''Ctrl-O''', then enter, to write the change to the file.
dtparam=pciex1_gen=3
<span class="tb_red_bold">WARNING:</span><span class="tb_red">The Raspberry Pi 5 is not certified for Gen 3.0 speeds, and connections to PCIe devices at these speeds may be unstable.Refer to [https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#pcie-gen-3-0 Official Statement]</span>
Then DON'T forgot to reboot
sudo reboot
You also can refer to official documentatio:[https://www.raspberrypi.com/documentation/computers/raspberry-pi-5.html#enablingenable-pcie Enabling PCIe]
After reboot,use the '''lspci''' command to display your PCIe devices
If you are flashing a fresh Pi OS to NVME ssd, you must [[#Enable PCIe]]; but if you are COPY or CLONE an old Pi OS from SD card to NVME ssd, and you have already enabled pcie in the old Pi OS in advance, then you don't need to do enable pcie again!
==Set Boot from PCIe (NVMe early in the boot orderSSD)==The PCIe connection should work after a rebootBy default, but your Raspberry Pi won't try booting off an NVMe SSD yetdevices do not boot from PCIe storage. For thatTo enable boot from PCIe, you need to change the '''BOOT_ORDER''' in the Raspberry Pi's bootloader configuration: * Use tool '''raspi-config''' to set boot order sudo raspi-configThen select '''6 Advanced Opitions''' => '''A4 Boot Order''' => '''B2 NVMe/USB Boot''' answer '''Yes''', then <code>sudo reboot</code>* Run . Edit the EEPROM configuration with the following command to set boot order.:
sudo rpi-eeprom-config --edit
Then change the BOOT_ORDER line to the following:
BOOT_ORDER=0xf416
To boot from a non-HAT+ device, also add the following line: PCIE_PROBE=1
- Press '''Ctrl-O''', then enter, to write the change to the file.
- Press '''Ctrl-X''' to exit nano (the editor).
* Or use tool '''raspi-config''' to set boot order
sudo raspi-config
Then select '''6 Advanced Opitions''' => '''A4 Boot Order''' => '''B2 NVMe/USB Boot''' answer '''Yes''', then <code>sudo reboot</code>
Read [https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#BOOT_ORDER Raspberry Pi's documentation on BOOT_ORDER] for all the details. For now, the pertinent bit is the '''6''' at the end: that is what tells the Pi to attempt NVMe boot first!