enjoy-digital / litex_m2sdr

LiteX based M2 SDR FPGA board.
BSD 2-Clause "Simplified" License
24 stars 2 forks source link

Do first test on Rapsberry PI 5. #18

Closed enjoy-digital closed 1 week ago

enjoy-digital commented 1 month ago

While testing, describe all the steps in the current issues to be able to reproduce later and include in a README for future users.

trabucayre commented 1 month ago

CM4 IO

Status

Flash raspberrypi OS image

Switch CM4 to a mass storage

For CM4 board with an eMMC, a jumper must be present on J12 to disable boot on eMMC, an USB cable connected before power up

To switch the CM4 to a mass storage usbboot must be downloaded:

git clone https://github.com/raspberrypi/usbboot
cd usboot
make
sudo ./rpiboot

Flash

Updating the eMMC requires to use rpi-imager (see software page)

wget https://downloads.raspberrypi.org/imager/imager_latest_amd64.deb
sudo apt install ./imager_latest_amd64.deb
sudo rpi-imager

Note: during rpi-imager sequence it's possible to set login/password and to enable ssh.

Once eMMC is updated, remove jumper and power cycle the board. After 2 boot/reboot sequence the board is ready to be used/tweaked.

Note: usb cable must be removed to be able to use keyboard/mouse connected to USB HUB connectors

Configuration update/fix

/boot/firmware/config.txt must be updated with following lines:

# required for dma mask
dtoverlay=pcie-32bit-dma

Tests

m2sdr_util info:

./m2sdr_util info
[> FPGA/SoC Info:
-----------------
SoC Identifier   : LiteX SoC on LiteX-M2SDR 2024-06-03 11:35:53.
FPGA DNA         : 0x0008550c7af9e854
FPGA Temperature : 62.0 °C
FPGA VCC-INT     : 1.00 V
FPGA VCC-AUX     : 1.79 V
FPGA VCC-BRAM    : 1.00 V

[> AD9361 Info:
---------------
AD9361 Product ID  : 00ff 
AD9361 Temperature : 223.7 °C

m2sdr_util dma_test:

./m2sdr_util dma_test
[> DMA loopback test:
---------------------
DMA_SPEED(Gbps) TX_BUFFERS      RX_BUFFERS      DIFF    ERRORS
          1.28        4032            3840       192         0
          1.96       10176            9984       192         0
          1.95       16320           16128       192         0
          1.41       20928           20736       192         0
          1.00       24000           23808       192         0
          1.00       27072           26880       192         0
          1.00       30144           29952       192         0
          1.00       33216           33024       192         0
          1.00       36288           36096       192         0
          1.00       39360           39168       192         0
DMA_SPEED(Gbps) TX_BUFFERS      RX_BUFFERS      DIFF    ERRORS
          1.00       42432           42240       192         0
          1.00       45504           45312       192         0
          1.00       48576           48384       192         0
          1.00       51648           51456       192         0
          1.00       54720           54528       192         0
          1.00       57792           57600       192         0
          1.00       60864           60672       192         0
          1.00       63936           63744       192         0
          1.00       67008           66816       192         0
          1.00       70080           69888       192         0
DMA_SPEED(Gbps) TX_BUFFERS      RX_BUFFERS      DIFF    ERRORS
          1.00       73152           72960       192         0
          1.00       76224           76032       192         0
          1.00       79296           79104       192         0

Note::

[  690.696453] litepcie 0000:01:00.0: Reading too late, 256 buffers lost
[  690.696477] litepcie 0000:01:00.0: Writing too late, 256 buffers lost

m2sdr_util -z dma_test:

./m2sdr_util -z dma_test
[> DMA loopback test:
---------------------
DMA_SPEED(Gbps) TX_BUFFERS      RX_BUFFERS      DIFF    ERRORS
          0.64        2560            2432       128         0
          1.29       12128           12000       128         0
          0.65       21024           20896       128         0
          0.33       34688           34560       128         0
          0.33       76000           75872       128         0
          0.33      200832          200704       128         0

Result are suspect, many lags...

m2sdr_record

SPEED decrease when slow samplerate and increase with highest sample rate

Example with ./m2sdr_rf --samplerate 10e6

./m2sdr_record
SPEED(Gbps)    BUFFERS SIZE(MB)
      0.63       1952         0
      0.64       3936         0
      0.64       5920         0
      0.64       7904         0
      0.64       9888         0
      0.64      11872         0
      0.64      13856         0
      0.64      15840         0
      0.64      17824         0
      0.64      19808         0
SPEED(Gbps)    BUFFERS SIZE(MB)
      0.64      21792         0
      0.64      23776         0
      0.64      25760         0
      0.64      27744         0
      0.64      29728         0
      0.64      31712         0
      0.64      33696         0
      0.64      35680         0
      0.64      37664         0
      0.64      39648         0
SPEED(Gbps)    BUFFERS SIZE(MB)
      0.64      41632         0

SoapySDR/GQRX/GNURadio

sudo apt install libsoapysdr-dev soapysdr-tools gqrx-sdr gnuradio gnuradio-dev cmake pulseaudio

SoapySDR

SoapySDRUtil --probe="driver=LiteXM2SDR"
######################################################
##     Soapy SDR -- the SDR abstraction library     ##
######################################################

Probe device driver=LiteXM2SDR
[INFO] SoapyLiteXM2SDR initializing...
[INFO] Opened devnode /dev/m2sdr0, serial 8550c7af9e854
ad9361_init : AD936x Rev 2 successfully initialized
[INFO] SoapyLiteXM2SDR initialization complete

----------------------------------------------------
-- Device identification
----------------------------------------------------
  driver=LiteX-M2SDR
  hardware=R01

----------------------------------------------------
-- Peripheral summary
----------------------------------------------------
  Channels: 2 Rx, 2 Tx
  Timestamps: NO
  Sensors: fpga_temp, fpga_vccint, fpga_vccaux, fpga_vccbram, ad9361_temp
     * fpga_temp: 63.120428 °C
        FPGA temperature
     * fpga_vccint: 1.002686 V
        FPGA internal supply voltage
     * fpga_vccaux: 1.787842 V
        FPGA auxiliary supply voltage
     * fpga_vccbram: 1.002686 V
        FPGA block RAM supply voltage
     * ad9361_temp: 32 °C
        AD9361 temperature

----------------------------------------------------
-- RX Channel 0
----------------------------------------------------
  Full-duplex: YES
  Supports AGC: YES
  Stream formats: CF32
  Native format: CF32 [full-scale=1]
  Antennas: A_BALANCED
  Full gain range: [0, 73] dB
    PGA gain range: [0, 73] dB
  Full freq range: [70, 6000] MHz
    RF freq range: [70, 6000] MHz
  Sample rates: [0.260417, 61.44] MSps
  Filter bandwidths: [0.2, 56] MHz

----------------------------------------------------
-- RX Channel 1
----------------------------------------------------
  Full-duplex: YES
  Supports AGC: YES
  Stream formats: CF32
  Native format: CF32 [full-scale=1]
  Antennas: A_BALANCED
  Full gain range: [0, 73] dB
    PGA gain range: [0, 73] dB
  Full freq range: [70, 6000] MHz
    RF freq range: [70, 6000] MHz
  Sample rates: [0.260417, 61.44] MSps
  Filter bandwidths: [0.2, 56] MHz

----------------------------------------------------
-- TX Channel 0
----------------------------------------------------
  Full-duplex: YES
  Supports AGC: NO
  Stream formats: CF32
  Native format: CF32 [full-scale=1]
  Antennas: A
  Full gain range: [-89, 0] dB
    PGA gain range: [-89, 0] dB
  Full freq range: [47, 6000] MHz
    RF freq range: [47, 6000] MHz
  Sample rates: [0.260417, 61.44] MSps
  Filter bandwidths: [0.2, 56] MHz

----------------------------------------------------
-- TX Channel 1
----------------------------------------------------
  Full-duplex: YES
  Supports AGC: NO
  Stream formats: CF32
  Native format: CF32 [full-scale=1]
  Antennas: A
  Full gain range: [-89, 0] dB
    PGA gain range: [-89, 0] dB
  Full freq range: [47, 6000] MHz
    RF freq range: [47, 6000] MHz
  Sample rates: [0.260417, 61.44] MSps
  Filter bandwidths: [0.2, 56] MHz

[INFO] Power down and cleanup

GQRX

Tested at 10MS/s: no problem sound looks good and no overflow/underflow

GNURadio with FM receiver flowchart

Works but lot of Os, maybe the flowchart must be optimized to reduce CPU load.

trabucayre commented 1 month ago

Raspberry PI5

Status

Flash raspberrypi OS image

Unlike CM4, RPI5 uses a classic SDCard as rootfs

Flash

Updating the eMMC requires to use rpi-imager (see software page)

wget https://downloads.raspberrypi.org/imager/imager_latest_amd64.deb sudo apt install ./imager_latest_amd64.deb sudo rpi-imager

Select:

Note: during rpi-imager sequence it's possible to set login/password and to enable ssh.

After 2 boot/reboot sequence the board is ready to be used/tweaked.

Configuration update/fix

/boot/firmware/config.txt must be updated with following lines:

# required for dma mask and MSI instead of MSI-X
kernel=kernel8.img
dtparam=pciex1=on
dtoverlay=pcie-32bit-dma-pi5
dtoverlay=pciex1-compat-pi5,l1ss=off,no-l0s=on,no-mip=off

/boot/firmware/cmdline.txt must be updated to add following options:

pci=noaer pcie_aspm=off

Tests

m2sdr_util info

./lm2sdr_util info
[> FPGA/SoC Info:
-----------------
SoC Identifier   : LiteX SoC on LiteX-M2SDR 2024-06-05 15:44:28.
FPGA DNA         : 0x0008550c7af9e854
FPGA Temperature : 84.4 °C
FPGA VCC-INT     : 1.00 V
FPGA VCC-AUX     : 1.79 V
FPGA VCC-BRAM    : 1.00 V

[> AD9361 Info:
---------------
AD9361 Product ID  : 00ff 
AD9361 Temperature : 223.7 °C

m2sdr_util dma_test

./m2sdr_util dma_test
[> DMA loopback test:
---------------------
DMA_SPEED(Gbps) TX_BUFFERS      RX_BUFFERS      DIFF    ERRORS
          2.59        8064            7936       128         0
          3.64       19328           19200       128         0
          3.64       30592           30464       128         0
          2.25       37760           37632       128         0
          2.04       44160           44032       128         0
          2.05       50560           50432       128         0
          2.04       56960           56832       128         0
          2.05       63360           63232       128         0
          2.04       69760           69632       128         0
          2.05       76160           76032       128         0

m2sdr_util -z dma_test:

./m2sdr_util dma_test -z
[> DMA loopback test:
---------------------
DMA_SPEED(Gbps) TX_BUFFERS      RX_BUFFERS      DIFF    ERRORS
          2.54        8768            8640       128         0
          3.91       20864           20736       128         0
          3.68       32160           32032       128         0
          1.37       37536           37408       128         0
          1.25       45376           45248       128         0
          1.25       53312           53184       128         0
          1.26       66304           66176       128         0
          1.26       87520           87392       128         0
          1.26      122112          121984       128         0
          1.26      178560          178400       160         0

m2sdr_record

SPEED decrease when slow samplerate and increase with highest sample rate

Example with ./m2sdr_rf --samplerate 10e6:

./m2sdr_record
SPEED(Gbps)    BUFFERS SIZE(MB)
      0.63       1952         0
      0.64       3936         0
      0.64       5920         0
      0.64       7904         0
      0.64       9888         0
      0.64      11872         0
      0.64      13856         0
      0.64      15840         0
      0.64      17824         0
      0.64      19808         0

SoapySDR/GQRX/GNURadio

sudo apt install libsoapysdr-dev soapysdr-tools gqrx-sdr gnuradio gnuradio-dev cmake pulseaudio  libgtk-3-dev
usermod -G pulse user-name

SoapySDR

SoapySDRUtil --probe="driver=LiteXM2SDR"
######################################################
##     Soapy SDR -- the SDR abstraction library     ##
######################################################

Probe device driver=LiteXM2SDR
[INFO] SoapyLiteXM2SDR initializing...
[INFO] Received arguments:
[INFO]   bitmode: 16
[INFO]   device: LiteX-M2SDR
[INFO]   driver: LiteXM2SDR
[INFO]   identification: LiteX SoC on LiteX-M2SDR 2024-06-05 15:44:28
[INFO]   label: LiteX-M2SDR /dev/m2sdr0 8550c7af9e854 LiteX SoC on LiteX-M2SDR 2024-06-05 15:44:28
[INFO]   oversampling: 0
[INFO]   path: /dev/m2sdr0
[INFO]   serial: 8550c7af9e854
[INFO]   version: 1234
[INFO] Opened devnode /dev/m2sdr0, serial 8550c7af9e854
ad9361_init : AD936x Rev 2 successfully initialized
[INFO] SoapyLiteXM2SDR initialization complete

----------------------------------------------------
-- Device identification
----------------------------------------------------
  driver=LiteX-M2SDR
  hardware=R01

----------------------------------------------------
-- Peripheral summary
----------------------------------------------------
  Channels: 2 Rx, 2 Tx
  Timestamps: NO
  Sensors: fpga_temp, fpga_vccint, fpga_vccaux, fpga_vccbram, ad9361_temp
     * fpga_temp: 106.553821 °C
        FPGA temperature
     * fpga_vccint: 0.995361 V
        FPGA internal supply voltage
     * fpga_vccaux: 1.784912 V
        FPGA auxiliary supply voltage
     * fpga_vccbram: 0.996094 V
        FPGA block RAM supply voltage
     * ad9361_temp: 75 °C
        AD9361 temperature

----------------------------------------------------
-- RX Channel 0
----------------------------------------------------
  Full-duplex: YES
  Supports AGC: YES
  Stream formats: CF32
  Native format: CF32 [full-scale=1]
  Antennas: A_BALANCED
  Full gain range: [0, 73] dB
    PGA gain range: [0, 73] dB
  Full freq range: [70, 6000] MHz
    RF freq range: [70, 6000] MHz
  Sample rates: [0.260417, 61.44] MSps
  Filter bandwidths: [0.2, 56] MHz

----------------------------------------------------
-- RX Channel 1
----------------------------------------------------
  Full-duplex: YES
  Supports AGC: YES
  Stream formats: CF32
  Native format: CF32 [full-scale=1]
  Antennas: A_BALANCED
  Full gain range: [0, 73] dB
    PGA gain range: [0, 73] dB
  Full freq range: [70, 6000] MHz
    RF freq range: [70, 6000] MHz
  Sample rates: [0.260417, 61.44] MSps
  Filter bandwidths: [0.2, 56] MHz

----------------------------------------------------
-- TX Channel 0
----------------------------------------------------
  Full-duplex: YES
  Supports AGC: NO
  Stream formats: CF32
  Native format: CF32 [full-scale=1]
  Antennas: A
  Full gain range: [-89, 0] dB
    PGA gain range: [-89, 0] dB
  Full freq range: [47, 6000] MHz
    RF freq range: [47, 6000] MHz
  Sample rates: [0.260417, 61.44] MSps
  Filter bandwidths: [0.2, 56] MHz

----------------------------------------------------
-- TX Channel 1
----------------------------------------------------
  Full-duplex: YES
  Supports AGC: NO
  Stream formats: CF32
  Native format: CF32 [full-scale=1]
  Antennas: A
  Full gain range: [-89, 0] dB
    PGA gain range: [-89, 0] dB
  Full freq range: [47, 6000] MHz
    RF freq range: [47, 6000] MHz
  Sample rates: [0.260417, 61.44] MSps
  Filter bandwidths: [0.2, 56] MHz

[INFO] Power down and cleanup

GQRX

m2sdr is detected, waterfall / fft okay, not tested sound -> rpi5 reboot due to undervoltage

GNU Radio

Same issue not enough power / too high temperature

enjoy-digital commented 1 week ago

Initial tests have been done on Raspberry CM4 and Pi 5. We can close now and will open more specific isssues when/if required.