Skip to main content

Building a Digital Mobile Radio Repeater Part 1: MMDVM

Main4_4779dbd6d6ea833d62af2c5247c037e0293b4bf7.jpg

Installing MMDVM on an STM32F4 NUCLEO board and assembling an interface shield.

In this series of posts we take a look at building a Digital Mobile Radio (DMR) repeater for amateur radio use on the 70cm band (UHF). This will be constructed using two surplus mobile analogue (FM) transceivers for uplink and downlink, paired with an open source MMDVM-based system for the digital modem, repeater control and IP network interconnect.

The repeater will be put to use by a local amateur radio group that frequently provide communications support to community events such as fell races, along with any radio ham visitors to the area and, of course, those remote and connected to the IP-linked digital radio network.

What is DMR?

DMR_6d77d0dcb84b03417dcdb02ad400caa5f361a239.jpg

Logo of the DMR Association.

DMR is an open digital mobile radio standard defined by ETSI and with use specified in three tiers:

  • Tier I. Licence-free use in Europe on the 446MHz band. Non-infrastructure and without repeater use.
  • Tier II. Licensed use in PMR bands from 66-960MHz. Support for higher spectral efficiency, advanced voice features and IP data services.
  • Tier III. Trunking operation in bands from 66-960MHz, with support for voice and short messaging similar to TETRA.

The digital standard is also suited to and actively used in, the 2M and 70cm amateur radio bands, which in the UK are licensed for 144-146MHz and 430-440MHz use respectively.

DMR can support two voice channels within a standard 12.5kHz channel spacing, via TDMA with two time slots. 4-state FSK modulation is used at a rate of 4,800 samples per second, which corresponds to 9,600 bits/s. So it is a fairly efficient system, without being overly complex.

Many different vendors offer DMR radio equipment. However, for our repeater we will be using two surplus analogue PMR radios, together with Multi-Mode Digital Voice Modem (MMDVM).

Multiple standard and hardware platform support

MMDVM_f42f99f3c6877ae6a3ea54eae219e058e3e57f93.jpg

MMDVM is an open source software project licensed under GPL v2, but with a note to say that it is intended for amateur and educational use only, with commercial use strictly forbidden. This does seem possibly at odds with the GPL licence, but is likely to do with digital codec patents.

The MMDVM firmware supports the following digital modes:

  • D-Star
  • DMR Tier II
  • System Fusion
  • P25

Supported platforms include:

  • Arduino Due
  • STM32F407-DISCO
  • STM32F446-NUCLEO
  • Teensy 3.1/3.2/3.5/3.6

With build supported via the Arduino IDE, Coocox IDE with ARM GCC, and Teensyduino.

It should also be possible to build MMDVM for other STM32 boards and to port it to other real-time ARM platforms, provided they have suitable performance, plus at least one ADC and DAC.

In addition to repeater use, MMDVM can also be used to create a “hotspot” that connects to a digital network over IP link and facilitates use of a handheld radio on the move. Hats off to its creator, Jonathan Naylor (G4KLX), for creating a very cool piece of software.

Modem platform

NUCLEO1_7c829a138f48b716ebe99bb7476d630b47b57201.jpg

We opted to build our system around the STM32F446 NUCLEO development board (906-4624) , since this offers excellent price/performance and thanks to French radio amateur, F5UII, there is a neat add-on shield which provides interfacing for two radios and an LCD touch screen.

NUCLEOShield1_cbe1d2d950a87cd264a37e492c9233f40643986f.jpg

(Edit: STM32F446 board is shown invertered here — it's USB connector should be on the outside and not positioned between the two boards!)

The shield provides op amps which are situated between the radio RX and microcontroller ADC, and radio TX and the microcontroller DAC. There is also a TCXO for frequency stability, some basic buffering and level conversion, plus indicators for the mode in use and PTT active etc.

ShieldKit_dbba3d991b95d58059021e63505a0b77e2d177ac.jpg

The shield was supplied as a kit of through-hole parts and took very little time to assemble.

Toolchain setup

The instructions provided by F5UII walk through the few steps required to install a toolchain on Windows. However, since we were using Ubuntu it was even more straightforward.

First, installing the embedded ARM toolchain:

$ sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa

$ sudo apt-get update

$ sudo apt-get install gcc-arm-embedded

Then cloning the sources and building stlink, which is required to program the NUCLEO board:

$ git clone https://github.com/texane/stlink

$ cd stlink

$ make

The executables are then copied into /usr/local/bin:

$ sudo cp build/Release/st-* /usr/local/bin

Following which the udev rules are copied into place and udev restarted:

$ sudo cp etc/udev/rules.d/49-stlinkv* /etc/udev/rules.d/

$ sudo udevadm control --reload-rules

$ sudo udevadm trigger

Finally, if the NUCLEO board is plugged in and st-info run as follows:

$ st-info --probe

We should have confirmation that 1 stlink programmer has been found.

Building and installing MMDVM

BDR_MMDVMCompile_d9a070e72633be65e0c1bb5c951902f79617168d.jpg

Now on to building MMDVM and first the sources are cloned:

$ git clone https://github.com/g4klx/MMDVM.git

$ cd MMDVM

Next we need the STM32F4 DSP and standard peripherals library, which could be downloaded in full from ST, or a minimal set of the files required can be downloaded from F5UII:

$ wget https://www.f5uii.net/wp-content/uploads/2016/12/STM32F4XX_Lib.zip

$ unzip STM32F4XX_Lib.zip

The Config.h file in the root of the repository will need to be edited. We set the configuration lines:

#define EXTERNAL_OSC 12000000

#define STM32F4_NUCLEO_MORPHO_HEADER

#define SEND_RSSI_DATA

#define SERIAL_REPEATER

Following which we ran the build:

$ make clean

$ make nucleo

BDR_Flash_7f9ae743787f7cf32900c9e019c66b62b385506a.jpg

This resulted in a hex file that we could program to the board with:

$ st-flash --format ihex write bin/outp.hex

Next steps

In the next post we’ll look at housing our modem together with a Raspberry Pi host and two UHF radios, in a rack mount enclosure with power distribution.

Andrew Back

Open source (hardware and software!) advocate, Treasurer and Director of the Free and Open Source Silicon Foundation, organiser of Wuthering Bytes technology festival and founder of the Open Source Hardware User Group.

Comments