Building a Digital Mobile Radio Repeater Part 1: MMDVM
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?
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 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:
- DMR Tier II
- System Fusion
Supported platforms include:
- Arduino Due
- 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.
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.
(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.
The shield was supplied as a kit of through-hole parts and took very little time to assemble.
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
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
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
Following which we ran the build:
$ make clean
$ make nucleo
This resulted in a hex file that we could program to the board with: