Airspy HF+ User-Mode Driver

repository·master·Indexed 41 days ago

https://github.com/airspy/airspyhf

A user-mode driver for the Airspy HF+, a high-performance software-defined radio (SDR) designed for HF and VHF bands. Includes build instructions for Windows (VisualStudio and MinGW) and Linux, udev rule configuration, and examples for using the airspyhf_rx tool with csdr for FM demodulation and spectrum visualization.

Tokens
1.4K
Snippets
8
Records
8
Agent score
2%

What's inside Airspy HF+

  1. Build host software on Windows with VisualStudio

    master

    To build the Airspy HF+ host software using VisualStudio (2013 or later), follow these steps to prepare the environment and compile the solution:

    1. Clone the repository: git clone https://github.com/airspy/airspyhf.git host
    2. Download and extract libusb-1.0.20.7z into the host directory (resulting in host\libusb-1.0.20).
    3. Download and extract pthreads-w32-2-9-1-release.zip into the host directory (resulting in host\libpthread-2-9-1-win).
    4. Open src/airspyhf.sln in VisualStudio.
    5. Set the build configuration to Release and select either x86 or x64.
    6. Select Build Solution.
    git clone https://github.com/airspy/airspyhf.git host
  2. Build host software on Linux (Debian/Ubuntu/Raspbian)

    master

    Follow these steps to install the necessary dependencies and build the host software on Debian-based Linux systems.

    1. Install Prerequisites: sudo apt-get install build-essential cmake libusb-1.0-0-dev pkg-config

    2. Download and Extract: wget https://github.com/airspy/airspyhf/archive/master.zip unzip master.zip cd airspyhf-master

    3. Build and Install: mkdir build && cd build cmake ../ [options] make sudo make install sudo ldconfig

    sudo apt-get install build-essential cmake libusb-1.0-0-dev pkg-config
  3. Build host software on Windows with MinGW

    master

    To build the host software using MinGW and CMake, use the following commands. Ensure you have the necessary libusb include directories configured.

    Normal version:

    git clone https://github.com/airspy/airspyhf.git host
    cd host
    mkdir build
    cd build
    cmake ../ -G "MSYS Makefiles" -DLIBUSB_INCLUDE_DIR=/usr/local/include/libusb-1.0/
    make
    make install

    Debug version:

    git clone https://github.com/airspy/airspyhf.git host
    cd host
    mkdir build
    cd build
    cmake ../ -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Debug -DLIBUSB_INCLUDE_DIR=/usr/local/include/libusb-1.0/
    make
    make install
    cmake ../ -G "MSYS Makefiles" -DLIBUSB_INCLUDE_DIR=/usr/local/include/libusb-1.0/
  4. Configure Linux udev rules during CMake build

    master

    When building on Linux, you can choose how the device permissions are handled via CMake flags. This is important for ensuring applications can access the Airspy HF+ hardware.

    • MODE/GROUP (Default/Networked): Use -DINSTALL_UDEV_RULES=ON. This allows read/write permissions only for the logged-in user and members of the plugdev group. The plugdev group is created automatically during installation. This is recommended for networked systems like SpyServers.
    • uaccess (Stand-alone): Use -DUSE_UACCESS_RULES=ON. This uses the uaccess paradigm, which is often less restrictive and better for stand-alone, non-Debian-based Linux systems to ensure applications can 'see' the device.

    To revert from uaccess back to the default MODE/GROUP paradigm, rebuild using: cmake ../ -DUSE_UACCESS_RULES=OFF -DINSTALL_UDEV_RULES=ON

    Note: MacOS does not require these udev options.

    cmake ../ -DINSTALL_UDEV_RULES=ON
  5. Display the spectrum using airspyhf_rx and csdr

    master

    You can visualize the radio spectrum by piping airspyhf_rx output into csdr fft_cc and then into octave.

    Required flags:

    • -z: (Implicitly used in example for specific mode)
    • -d: (Implicitly used in example for specific mode)
    • -r stdout: Directs output to standard output.
    • -f $FREQ: Sets the center frequency in MHz.
    • -m on: Enables specific mode/metadata.
    • csdr fft_cc 1024 120000 HAMMING --octave: Performs FFT with 1024 points, 120kHz bandwidth, and a Hamming window.
    # frequency in MHz
    FREQ=107.9
    airspyhf_rx -z -d -r stdout -f $FREQ -m on | csdr fft_cc 1024 120000 HAMMING --octave | octave -i > /dev/null
  6. Display a graph of raw I/Q samples

    master

    To visualize raw I/Q samples as a 2D graph, pipe airspyhf_rx output into csdr octave_complex_c and then into octave.

    Required flags:

    • -z, -d: Mode selection.
    • -r stdout: Directs output to standard output.
    • -f $FREQ: Sets the center frequency in MHz.
    • -m on: Enables specific mode/metadata.
    • csdr octave_complex_c 1024 120000 --2d: Prepares complex data for Octave with 1024 points, 120kHz bandwidth, and 2D plotting.
    # frequency in MHz
    FREQ=107.9
    airspyhf_rx -z -d -r stdout -f $FREQ -m on | csdr octave_complex_c 1024 120000 --2d | octave -i > /dev/null
  7. Test airspyhf_rx on Linux using csdr

    master

    The airspyhf_rx tool can be integrated into a signal processing pipeline on Linux using the csdr package. csdr modules follow the Unix filter paradigm, receiving data via stdin and sending processed data to stdout.

    To perform FM demodulation and play audio, you can pipe the output of airspyhf_rx through several csdr filters (demodulator, decimator, de-emphasis, and format converter) into mplayer.

    Note: airspyhf_rx outputs IQ data in 32-bit floating point format.

    # frequency in MHz
    FREQ=107.9
    
    tools/src/airspyhf_rx -z -r stdout -f $FREQ | \
    csdr fmdemod_quadri_cf | \
    csdr fractional_decimator_ff 16 | \
    csdr deemphasis_wfm_ff 48000 50e-6 | \
    csdr convert_f_s16 | \
    mplayer -cache 1024 -quiet -rawaudio samplesize=2:channels=1:rate=48000 -demuxer rawaudio -