DVMProject / dvmhost

MMDVM-based Digital Voice Modem Host Software
GNU General Public License v2.0
52 stars 15 forks source link
dmr nxdn p25 radio sdr trunking

Digital Voice Modem Core Software Suite

The Digital Voice Modem ("DVM") Core Software Suite, provides the a set of applications that:

Please feel free to reach out to us for help, comments or otherwise, on our Discord: https://discord.gg/3pBe8xgrEz

This project suite generates a few executables:

Building

This project utilizes CMake for its build system. (All following information assumes familiarity with the standard Linux make system.)

The DVM Host software requires the library dependancies below. Generally, the software attempts to be as portable as possible and as library-free as possible. A basic GCC/G++ install, with libasio and ncurses is usually all that is needed to compile.

Dependencies

apt-get install libasio-dev libncurses-dev libssl-dev

Alternatively, if you download the ASIO library from the ASIO website and extract it to a location, you can specify the path to the ASIO library using: -DWITH_ASIO=/path/to/asio. This method is required when cross-compiling for old Raspberry Pi ARM 32 bit.

If cross-compiling ensure you install the appropriate libraries, for example for AARCH64/ARM64:

sudo dpkg --add-architecture arm64
sudo apt-get update
sudo apt-get install libasio-dev:arm64 libncurses-dev:arm64 libssl-dev:arm64

Build Instructions

  1. Clone the repository. git clone https://github.com/DVMProject/dvmhost.git
  2. Switch into the "dvmhost" folder. Create a new folder named "build" and switch into it.
    # cd dvmhost
    dvmhost # mkdir build
    dvmhost # cd build
  3. Run CMake with any specific options required. (Where [options] is any various compilation options you require.)
    dvmhost/build # cmake [options] ..
    ...
    -- Build files have been written to: dvmhost/build
    dvmhost/build # make

If cross-compiling is required (for either ARM 32bit, 64bit or old Raspberry Pi ARM 32bit), the CMake build system has some options:

Please note cross-compliation requires you to have the appropriate development packages installed for your system. For ARM 32-bit, on Debian/Ubuntu OS install the "arm-linux-gnueabihf-gcc" and "arm-linux-gnueabihf-g++" packages. For ARM 64-bit, on Debian/Ubuntu OS install the "aarch64-linux-gnu-gcc" and "aarch64-linux-gnu-g++" packages.

See project notes.

Setup TUI (Text-based User Interface)

Since, DVM Host 3.5, the old calibration and setup modes have been deprecated in favor of a ncurses-based TUI. This TUI is optional, and DVM Host can still be compiled without it for systems or devices that cannot utilize it.

dvmhost Configuration

This source repository contains configuration example files within the configs folder, please review config.example.yml for the dvmhost for details on various configurable options. When first setting up a DVM instance, it is important to properly set the channel "Identity Table" or "Logical Channel ID" (or LCN ID) data, within the iden_table.dat file and then calibrate the modem.

The iden_table.dat file contains critical information used by dvmhost (and some other related applications) to calculate frequencies for Rx/Tx, these calculations are used for over the air broadcast messages that direct radios to which frequency to tune to when in trunking mode. Additionally, the iden_table.dat frequency calculations are also used to determine what frequency a hotspot operates on.

There is a helper CLI Python tool called iden-channel-calculator (For more information please, see: https://github.com/DVMProject/iden-channel-calculator) to help calculate and generate iden_table.dat entries, along with determine which relative channel number relates to a specified frequency.

It should also be important to read and review the calibration notes below.

Initial Setup Steps

The following setups assume the host is compiled with the setup TUI mode (if available) [NOTE: Steps 3 - 5 only apply to the air interface modem.]. It is possible to setup the modem without the setup TUI, and requires manually modifying config.yml and the iden_table.dat files.

  1. Create/Edit config.yml and ensure the settings for the modem are correct, find the "modem" section in "system". Check that the uart settings have the appropriate UART port and port speed set (the config.yml defaults to /dev/ttyUSB0 and 115200).
    1. If using the air modem interface, ensure the the modem protocol mode is set to "air".
    2. If using the V.24 DFSI modem interface, ensure the modem protocol mode is set to "dfsi".
      1. The V.24 DFSI modem has multiple firmware revisions, it is required to use firmware version 2.0 or greater for use with dvmhost.
  2. Start dvmhost as follows: /path/to/dvmhost -c /path/to/config.yml --setup. This will start the dvmhost setup TUI mode.
  3. Using the TUI user interface, use the "Setup" menu to set default parameters.
    1. The "Logging & Data Configuration" submenu allows you to alter the various logging file paths and levels, as well as paths to data files (such as the iden_table.dat file).
    2. The "System Configuration" submenu allows you to alter various modem port and speed, system settings, and mode settings configuration.
    3. The "Site Parameters" submenu allows you to alter various CW morse identification, and site parameters.
    4. The "Channel Configuration" submenu allows you to alter the configured channel for the modem you are configuring.
  4. After altering settings, use the "File" menu, "Save Settings" menu option to save the desired configuration.
  5. Quit setup mode (some settings changes require a restart of the software to be effective) using, "File" menu, "Quit".

(Air Interface) Transmit Calibration (using setup TUI, if available)

  1. Start dvmhost as follows: /path/to/dvmhost -c /path/to/config.yml --setup. This will start the dvmhost setup TUI mode. The best way to calibrate the DVM is to use a radio from which you can receive and transmit the appropriate test patterns (for example using ASTRO25 Tuner and an XTS radio to use the "Bit Error Rate" functions under Performance Testing).
  2. Depending on which protocol you are calibration with, use the "Calibrate" menu, and select the appropriate mode using the "Operational Mode" submenu. (For example, select [Tx] DMR BS 1031 Hz Test Pattern for DMR or [Tx] P25 1011 Hz Test Pattern (NAC293 ID1 TG1) for P25.)
  3. Open the "Level Adjustment" window by either, using the "Calibrate" menu and selecting "Level Adjustment" or if capable, pressing F5 on the keyboard.
  4. Ensure the TX Level is set to 50 (it should be by default, you can use the spinbox in the "Level Adjustment" window to change the value, if necessary to set it to 50).
  5. If the hardware in use has a TX potentiometer, set it to the to minimum level.
  6. Start Tx (click "Transmit" or press F12 on the keyboard).
  7. While observing the BER via whatever means available, adjust the TX potentiometer (if the modem hardware allows) for the lowest received BER. Adjust the software TX Level for some fine tuning with the spinbox in the "Level Adjustment" window.
  8. Stop Tx (click "Transmit" or press F12 on the keyboard).
  9. After altering settings, use the "File" menu, "Save Settings" menu option to save the desired configuration.
  10. Quit setup mode, if done doing calibration, using, "File" menu, "Quit".

(Air Interface) Transmit Calibration (using old calibration CLI)

  1. Start dvmhost as follows: /path/to/dvmhost -c /path/to/config.yml --cal. This will start the dvmhost calibration mode. The best way to calibrate the DVM is to use a radio from which you can receive and transmit the appropriate test patterns (for example using ASTRO25 Tuner and an XTS radio to use the "Bit Error Rate" functions under Performance Testing).
  2. Depending on which protocol you are calibration with, enter DMR BS 1031 Hz Test Pattern (M) or P25 1011 Hz Test Pattern (NAC293 ID1 TG1) (P).
  3. Ensure the TXLevel is set to 50 (it should be by default, "`" will display current values, use "T" [increase] and "t" [decrease] if necessary to set it to 50).
  4. If the hardware in use has a TX potentiometer, set it to the to minimum level.
  5. Start Tx (press spacebar to toggle Tx).
  6. While observing the BER via whatever means available, adjust the TX potentiometer (if the modem hardware allows) for the lowest received BER. Adjust the software TXLevel for some fine tuning with the "T" (increase) and "t" (decrease).
  7. Stop Tx (press spacebar to toggle Tx).
  8. Save the configuration using "s" and quit calibration mode with "q".

(Air Interface) Receive Calibration (using setup TUI, if available)

  1. Start dvmhost as follows: /path/to/dvmhost -c /path/to/config.yml --setup. This will start the dvmhost setup TUI mode. The best way to calibrate the DVM is to use a radio from which you can receive and transmit the appropriate test patterns (for example using ASTRO25 Tuner and an XTS radio to use the "Transmitter Test Pattern" functions under Performance Testing).
  2. Depending on which protocol you are calibration with, use the "Calibrate" menu, and select the appropriate mode using the "Operational Mode" submenu. (For example, select [Rx] DMR BS 1031 Hz Test Pattern for DMR or [Rx] P25 1011 Hz Test Pattern (NAC293 ID1 TG1) for P25.)
  3. Open the "Level Adjustment" window by either, using the "Calibrate" menu and selecting "Level Adjustment" or if capable, pressing F5 on the keyboard.
  4. Ensure the RX Level is set to 50 (it should be by default, you can use the spinbox in the "Level Adjustment" window to change the value, if necessary to set it to 50).
  5. If the hardware in use has a RX potentiometer, set it to the to minimum level. (If using something like the RepeaterBuilder STM32 board, decrease both the coarse and fine potentiometers to minimum level.)
  6. While observing the BER via the setup TUI (Receive BER shows a large window in the top-right corner of the TUI when in a Rx BER test mode), adjust the RX potentiometer(s) for the lowest received BER. If necessary also adjust the software RX Level for some fine tuning with the spinbox in the "Level Adjustment" window.
  7. After altering settings, use the "File" menu, "Save Settings" menu option to save the desired configuration.
  8. Quit setup mode, if done doing calibration, using, "File" menu, "Quit".

(Air Interface) Receive Calibration (using old calibration CLI)

  1. Start dvmhost as follows: /path/to/dvmhost -c /path/to/config.yml --cal. This will start the dvmhost calibration mode. The best way to calibrate the DVM is to use a radio from which you can receive and transmit the appropriate test patterns (for example using ASTRO25 Tuner and an XTS radio to use the "Transmitter Test Pattern" functions under Performance Testing).
  2. Depending on which protocol you are calibration with, enter DMR BS 1031 Hz Test Pattern (M) or P25 1011 Hz Test Pattern (P).
  3. Ensure the RXLevel is set to 50 (it should be by default, "`" will display current values, use "R" [increase] and "r" [decrease] if necessary to set it to 50).
  4. If the hardware in use has a RX potentiometer, set it to the to minimum level. (If using something like the RepeaterBuilder STM32 board, decrease both the coarse and fine potentiometers to minimum level.)
  5. Depending on which protocol you are calibration with, enter DMR MS 1031 Hz Test Pattern (J) or P25 1011 Hz Test Pattern (j).
  6. While observing the BER via the calibration console, adjust the RX potentiometer(s) for the lowest received BER. If necessary also adjust the software RXLevel for some fine tuning with the "R" (increase) and "r" (decrease).
  7. Save the configuration using "s" and quit calibration mode with "q".

(Air Interface) Calibration Notes

dvmfne Configuration

This source repository contains configuration example files within the configs folder, please review fne-config.example.yml for the dvmfne for details on various configurable options. When first setting up a FNE instance, it is important to properly configure a talkgroup_rules.example.yml file, this file defines all the various rules for valid talkgroups and other settings.

There is no other real configuration for a dvmfne instance other then setting the appropriate parameters within the configuration files.

dvmbridge Configuration

This source repository contains configuration example files within the configs folder, please review bridge-config.example.yml for the dvmbridge for details on various configurable options.

If using local audio with dvmbridge, command line arguments for the input and output device are required. (See command line parameters below.)

On Windows, by default dvmbridge will utilize WinMM (Windows Multimedia API), this should work for most uses. If necessary, in some situations (like many instances of dvmbridge for example), it may be desirable to use the Windows high-performance audio subsystem, WASAPI (Windows Audio Session API), normally dvmbridge will always default to using WinMM on Windows systems (even those with WASAPI support), but using the command line parameter -wasapi will force dvmbridge to utilize WASAPI instead. (This may help with some cases of where audio is choppy as well.)

There is no other real configuration for a dvmbridge instance other then setting the appropriate parameters within the configuration files.

Command Line Parameters

dvmhost Command Line Parameters

usage: ./dvmhost [-vhdf][--syslog][--setup][-c <configuration file>][--remote [-a <address>] [-p <port>]]

  -v        show version information
  -h        show this screen
  -d        force modem debug
  -f        foreground mode

  --syslog  force logging to syslog

  --setup   setup and calibration mode

  -c <file> specifies the configuration file to use

  --remote  remote modem mode
  -a        remote modem command address
  -p        remote modem command port

  --        stop handling options

dvmfne Command Line Parameters

usage: ./dvmfne [-vhf][--syslog][-c <configuration file>]

  -v        show version information
  -h        show this screen
  -f        foreground mode

  --syslog  force logging to syslog

  -c <file> specifies the configuration file to use

  --        stop handling options

dvmbridge Command Line Parameters

usage: ./dvmbridge [-vhf][-i <input audio device id>][-o <output audio device id>][-c <configuration file>]

  -v        show version information
  -h        show this screen
  -f        foreground mode

  -i        input audio device
  -o        output audio device

  -wasapi   use WASAPI on Windows

  -c <file> specifies the configuration file to use

  --        stop handling options

Audio Input Devices:
    ... <list of audio input devices> ...

Audio Output Devices:
    ... <list of audio output devices> ...

dvmcmd Command Line Parameters

usage: ./dvmcmd [-dvhs][-a <address>][-p <port>][-P <password>] <command> <arguments ...>

  -d                          enable debug
  -v                          show version information
  -h                          show this screen

  -a                          remote modem command address
  -p                          remote modem command port
  -P                          remote modem authentication password

  -s                          use HTTPS/SSL

  --                          stop handling options

NOTE: See dvmcmd -h for full help for commands and arguments.

dvmmon Command Line Parameters

usage: ./dvmmon [-dvh][--hide-log][-c <configuration file>]

  -d                          enable debug
  -v                          show version information
  -h                          show this screen

  --hide-log                  hide interactive logging window on startup

  -c <file>                   specifies the monitor configuration file to use

  --                          stop handling options

Project Notes

Security Warnings

It is highly recommended that the REST API interface not be exposed directly to the internet. If such exposure is wanted/needed, it is highly recommended to proxy the dvmhost REST API through a modern web server (like nginx for example) rather then directly exposing dvmhost's REST API port.

Raspberry Pi Preparation Notes

Some extra notes for those who are using the Raspberry Pi, default Raspbian OS or Debian OS installations. You will not be able to flash or access the STM32 modem unless you do some things beforehand.

  1. Disable the Bluetooth services. Bluetooth will share the GPIO serial interface on /dev/ttyAMA0. On Rasbian OS or Debian OS, this is done by: sudo systemctl disable bluetooth then adding dtoverlay=disable-bt to /boot/config.txt.
  2. The default Rasbian OS and Debian OS will have a getty instance listening on /dev/ttyAMA0. This can conflict with the STM32, and is best if disabled. On Rasbian OS or Debian OS, this is done by: systemctl disable serial-getty@ttyAMA0.service
  3. On Debian Bookworm-based builds of Raspian OS, the getty instance on /dev/ttyAMA0 gets rebuilt on boot via a systemd generator, even if you've already disabled it. You'll need to disable this generator with: sudo systemctl mask serial-getty@ttyAMA0.service
  4. There's a default boot option which is also listening on the GPIO serial interface. This must be disabled. Open the /boot/cmdline.txt file in your favorite editor (vi or pico) and remove the console=serial0,115200 part.

The steps above can be done by the following commands:

sudo systemctl disable bluetooth.service serial-getty@ttyAMA0.service
sudo systemctl mask serial-getty@ttyAMA0.service
grep '^dtoverlay=disable-bt' /boot/config.txt || echo 'dtoverlay=disable-bt' | sudo tee -a /boot/config.txt
sudo sed -i 's/^console=serial0,115200 *//' /boot/cmdline.txt

After finishing these steps, reboot.

License

This project is licensed under the GPLv2 License - see the LICENSE file for details. Use of this project is intended, for amateur and/or educational use ONLY. Any other use is at the risk of user and all commercial purposes is strictly discouraged.