Below is the LiteX-M2SDR installed on a Raspberry Pi 5. Please follow the step-by-step tutorial below to get your SDR running.
To connect the LiteX-M2SDR on the Raspberry Pi 5 board, you need an M.2 hat like the Pineboards HatDrive BM1L.
This step requires rpi-imager. On Debian or similar OS, use this command to install the tool:
sudo apt install rpi-imager
Once installed, launch the tool with the following command (root user is required for write access to mass storage):
sudo rpi-imager
- Click on CHOOSE DEVICE and select Raspberry Pi 5.
- Click on CHOOSE OS and select Raspberry Pi OS (64-bit).
- Click on CHOOSE STORAGE and select the SD card (use
sudo fdisk -l
to list mass storage devices). - Click NEXT.
On the next page, rpi-imager allows OS customization:
If you plan to use SSH initially, click on EDIT SETTINGS,
go to the GENERAL pane to set the username and password:
and enable SSH in the SERVICES pane:
After configuration, click SAVE and then YES.
The next page is the last point before erasing the device: double-check the selected mass storage.
Now, rpi-imager will download the image and write it to the SD card.
Once rpi-imager has written the SD card, some modifications must be applied to use a PCIe device. Mount the first SD card partition and edit config.txt and cmdline.txt. Both files are in the firmware directory.
config.txt
In the [all]
section, please add:
kernel=kernel8.img
dtparam=pciex1=on
dtoverlay=pcie-32bit-dma-pi5
dtoverlay=pciex1-compat-pi5,l1ss=off,no-l0s=on,no-mip=off
# Run as fast as firmware/board allows
arm_boost=1
kernel8.img
: ensures a standard 4K PAGE SIZE instead of 16K.dtparam=pciex1=on
: enables PCIe support.dtoverlay=pcie-32bit-dma-pi5
: enables 32-bit DMA addressing instead of 64-bit.dtoverlay=pciex1-compat-pi5,l1ss=off,no-l0s=on,no-mip=off
: improves support for PCIe devices that may not work well with the default configuration;l1ss=off
disables a power-saving feature,no-l0s=on
disables L0s (Active State Power Management - L0s state), andno-mip=off
enables MIP (Maximum Payload Size Inference).
cmdline.txt
Please append the line with pci=noaer pcie_aspm=off
:
pci=noaer
: disables PCIe advanced error reporting (AER: Corrected error received
).pcie_aspm=off
: ignores PCIe Active State Power Management. Leaves any configuration done by firmware unchanged.
Please plug in your Ethernet cable, HDMI monitor, USB keyboard, and the MicroSD card generated earlier. You can power your Raspberry Pi now over the USB-C port using a 5V@4A power supply.
Log in over SSH using the assigned IP and your password:
ssh toto@XXX.YYY.Z.A
# Update the system
sudo apt update
sudo apt dist-upgrade
sudo reboot
Insert the LiteX-M2SDR module before powering your Raspberry Pi. You’ll need an M2x3mm screw to lock the SDR module in place.
# Log in over SSH using your IP and password
ssh toto@XXX.YYY.Z.A
# On the Raspberry Pi, clone the LiteX-M2SDR source tree
mkdir Code
cd Code
git clone https://github.com/enjoy-digital/litex_m2sdr
# Compile the LiteX-M2SDR Linux kernel driver for arm64
cd litex_m2sdr/software/kernel
# Note that this line not only compiles the driver, but also activates it
sudo ARCH=arm64 ./init.sh
# Compile the command line tools and the SoapySDR driver for LiteX-M2SDR
cd ..
# Install missing dependencies
sudo apt install -y cmake soapysdr-tools libsoapysdr0.8 libsoapysdr-dev
# Compile the command line tools and SoapySDR driver
./build
# Verify the list of compiled tools
git status
# If you want to use LiteX-M2SDR Python tools later
sudo apt install -y python3-numpy
user/m2sdr_util info
user/m2sdr_rf
On subsequent boots, manually insert the LitePCI driver and grant access to your user:
sudo modprobe ~/Code/litex_m2sdr/software/kernel/litepcie.ko
sudo chmod 666 /dev/m2sdr0
# Check whether it works
~/Code/litex_m2sdr/software/user/m2sdr_util info
TBD