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 SMT32F446RET 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.
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:
$ st-flash --format ihex write bin/outp.hex
In the next post we’ll get the corresponding host software, MMDVMHost, up and running on a Raspberry Pi that is cabled to the NUCLEO board. This is where most of the configuration will take place and the software will facilitate connection to a DMR network. On the other side, we’ll connect the shield to two UHF transceivers and following which will conduct some initial testing.
The Brandmeister network has some functions to request information via SMS messages. To access these functions specific keywords are to be sent to DMR ID 262993. Then the system responds as well via SMS on these requests. Below you’ll find an overview of these commands with some explanation. The commands are not case sensitive.
help Shows an overview of the available functions
echo Sends immediately a response to test the SMS function
wx Weather at the repeater site
wx help Overview of all available weather commands
wx Town Weather in the city ‘Town’
wx zip Town Weather in the area ‘zip’ in the city ‘Town’
wx zip, cc Weather in the area ‘zip’ in country ‘cc’
wx Town, cc Weather in the city ‘Town’ in country ‘cc’
wx zip Town, cc Weather in area ‘zip’ in city ‘Town’ in country ‘cc’
wx gps Weather at the actual position of the DMR user according to the radio’s GPS
metar xxxx METAR message at the airport identified by ICAO code ‘xxxx’
gps help Overview of all GPS commands
gps Shows actual GPS position including the name of the location (street, city) of the DMR radio. Also direction and distance in relation to the actual repeater are provided
gps set Stores the actual position as ‘Home’ location
gps home Shows distance and direction of the actual position in relation to the previously stored ‘Home’ position
gps callsign Shows distance and direction in relation to DMR user identified by ‘callsign’
Furthermore it’s possible to route DMR messages into the DAPNet pager network. More information regarding DAPNet can be found at the website of Dutch Amateur Pagernetwork and RWTH Aachen (Aachen University). Messages for DAPNet are to be sent to DMR ID 262994.
A pager message for DAPNet is to be sent in the format [callsign] [message], for instance PX0XXX This is a message from DMR to DAPNet . This sends a messagetext ‘This is a message from DMR to DAPNet’ to user PX0XXX . Prerequisite is that ‘PX0XXX’ is a registered DAPNet user.