define( 'WP_DEBUG_DISPLAY', false ); define( 'WP_DEBUG_LOG', false ); How to set up an M17 Hotspot from Scratch – Kit-Building, homebrewing and rough workmanship

How to set up an M17 Hotspot from Scratch

M17 is a new and free digital mode for voice and data transmissions, that comes without all the proprietary restrictions like DMR or D-Star, System Fusion and so on.

More information about this project can be found over here.

The system works with reflectors, and a lot of radios with a 9,6k interface and some additional hard- and software can be used to build a station or a repeater.

But the best hack is probably that – with some modifications and a firmware update – even popular cheap chinese DMR radios like the Tytera MD-380 or the dual bander UV-380 (and their clones) can be converted to M17/FM radios.
This is all work in progress and not yet finished, but there is already more than basic function. OPENRTX is the name of this great project whose developers work closely with the M17-Team.

This sounds interesting and you want to try I out ?

Sure.

The easiest way which does not even need any special hardware would be Droidstar. Its an app for your phone (Android and iOS) or PC with which you can log into the reflectors via internet and make some QSOs without a radio.

But if you do have a compatible handheld with which you want to take part,
the rather popular MMDVM hot spots can also be equipped with M17 functionality, provided you do have a suitable MMDVM hat.

So here is a small write up on how to setup an M17-compatible MMDVM installation on a Raspberry Pi on Raspberry Pi OS ord Debian
– totally from scratch:

Over all, there are three requirements which must be met to get a functioning system:

a.) the firmware version of the MMDVM hat must be equal/above 1.60
b.) you need the latest version of the MMDVMHost program
c.) M17Gateway must be installed which connects the controller to the reflectors

We will start with updating the hotspot’s firmware:

First we should update our system and get some tools for getting the sources and compiling them.

sudo apt-get update

sudo apt-get install git gcc-arm-none-eabi gdb-arm-none-eabi libstdc++-arm-none-eabi-newlib libnewlib-arm-none-eabi

The newest firmware can be found on Github.

cd ~
git clone https://github.com/juribeparada/MMDVM_HS<
cd MMDVM_HS/
git submodule init
git submodule update

Then you need to edit Config.h with the appropiate settings for your hardware:

nano Config.h

Select your board by uncommenting the correct line, in this case the MMDVM hat Rev. 1.1 up to 1.4 by DB9MAT/DF2ET and save with <strg>+<o>

// Select one board (STM32F103 based boards)
// 1) ZUMspot RPi or ZUMspot USB:
// #define ZUMSPOT_ADF7021
// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103:
//#define LIBRE_KIT_ADF7021
// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT &amp; DF2ET)
#define MMDVM_HS_HAT_REV12
// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT &amp; DF2ET &amp; DO7EN)
// #define MMDVM_HS_DUAL_HAT_REV10
// 5) Nano hotSPOT (BI7JTA)
// #define NANO_HOTSPOT
// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO &amp; BG5HHP)
// #define NANO_DV_REV10&gt;
// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU)
// #define D2RG_MMDVM_HS
// 8) BridgeCom SkyBridge HotSpot
// #define SKYBRIDGE_HS
// 9) LoneStar USB Stick ADF7071
// #define LONESTAR_USB</code>

Please pay attention to the TCXO (check the right frequency, it’s visible on the PCB) and uncomment the correct line
// TCXO of the ADF7021 // For 14.7456 MHz: #define ADF7021_14_7456 // For 12.2880 MHz: // #define ADF7021_12_2880

Select the way host and MMDVM communicate, in case of the Raspberry Pi’s GPIOs, that’s STM32_USART1_HOST

// Host communication selection:
#define STM32_USART1_HOST
//#define STM32_USB_HOST
//#define STM32_I2C_HOST

Activate LEDs for M17

// Use the D-Star and P25 LEDs for M17
// define USE_ALTERNATE_M17_LEDS

Now you are ready to compile with

make clean if you compiled with different options before

and make

If everything compiles as expected, you are ready to flash, but depending on what kind of Raspberry Pi / operating system you are using, you have to make sure that the serial port is is free and not in use for bluetooth or console, or you will get an error message

If you are using a Pi2 or Pi4 you may jump ahead.

If you are using a new copy of Raspberry Pi Os on a PI3, Pi Zero W or Zero 2W so you need to deactivate serial-getty:

Deactiviate serial-getty

Edit /boot/cmdline.txt:

sudo nano /boot/cmdline.txt
(remove the text: console=serial0,115200)

Disable services:

sudo systemctl disable serial-getty@ttyAMA0.service
sudo systemctl disable bluetooth.service

Edit /boot/config.txt

sudo nano /boot/config.txt

Add the following lines at the end of /boot/config.txt:

enable_uart=1
dtoverlay=pi3-disable-bt

And restart your Pi

sudo reboot

Flash the Firmware

Depending on what kind of hardware you are using, different commands exist to do the flashing:

like
sudo make mmdvm_hs_hat
or
sudo make mmdvm_hs_dual_hat
or
sudo make zumspot-pi

If flashing failes due to a missing stm32flash, cou can install it manually with the following:

cd ~
git clone https://git.code.sf.net/p/stm32flash/code stm32flash
cd stm32flash
make
sudo make install

Now you can try again.

If you are using a dual hat, make sure the booting jumpers on the PCB are set correctly.

BOOT0: completey removed
BOOT1: set to BOOT 1 -

So, this was the first part. Now you need to get a recent version of MMDVMHost. Are yopu planning to use an OLED-display? If so you should first enable i2c and spi and install the driver.

Detailed information on how to proceed with this can be found on F5UII’s homepage. In short you need to enable spi and i2c with raspi-config , add

i2c-dev
spidev

to /etc/modules and install the driver.

git clone https://github.com/hallard/ArduiPi_OLED
cd ArduiPi_OLED
sudo make

Install MMDVMHost

Check out the newest code and compile and install it.

git clone https://github.com/g4klx/MMDVMHost
cd MMDVMHost

Depending on if you need the OLED driver you either proceed with

sudo make -f Makefile.Pi.OLED
sudo make install

or just with

sudo make
sudo make install

Now the fun part begins: Configuring MMDVM.ini.

It’s in the MMDVMHost folder, but I would recommend saving it directly to /etc/MMDVM.ini which is the standard path, where MMDVMHost looks for it.

cp MMDVM.ini /etc/
sudo nano /etc/MMDVM.ini
[General]
Callsign=G9BF
Id=123456
Timeout=180
Duplex=1
# ModeHang=10
RFModeHang=10
NetModeHang=3
Display=None
Daemon=0

Set your call sign, your the radio ID and, depending if you have a simpley or duplex hostspot duplex to “0” or 1″.

If you have the OLED, set Display to OLED.

For testing it’s in my option easier to leave daemon at “0” and set it to “1” later, when you set up the systemd-services.

[Info]
RXFrequency=435000000
TXFrequency=435000000
Power=1
# The following lines are only needed if a direct connection to a DMR master is being used
Latitude=0.0
Longitude=0.0
Height=0
Location=Nowhere
Description=Multi-Mode Repeater
URL=www.google.co.uk

Pretty self-explanatory.

[Modem]
# Valid values are "null", "uart", "udp", and (on Linux) "i2c"
Protocol=uart
# The port and speed used for a UART connection
# UARTPort=\\.\COM4
# UARTPort=/dev/ttyACM0
UARTPort=/dev/ttyAMA0
UARTSpeed=115200
# The port and address for an I2C connection
I2CPort=/dev/i2c
I2CAddress=0x22
# IP parameters for UDP connection
ModemAddress=192.168.2.100
ModemPort=3334
LocalAddress=192.168.2.1
LocalPort=3335

TXInvert=1
RXInvert=0
PTTInvert=0
TXDelay=100
RXOffset=0
TXOffset=0
DMRDelay=0
RXLevel=50
TXLevel=50
RXDCOffset=0
TXDCOffset=0
RFLevel=100
# CWIdTXLevel=50
# D-StarTXLevel=50
# DMRTXLevel=50
# YSFTXLevel=50
# P25TXLevel=50
# NXDNTXLevel=50
# M17TXLevel=50
# POCSAGTXLevel=50
# FMTXLevel=50
# AX25TXLevel=50
RSSIMappingFile=RSSI.dat
UseCOSAsLockout=0
Trace=0
Debug=0

Here I set the UARTSpeed to 115200.

The values for RXOffset and TXOffset vary for every board and should be measured with MMDVMCal on DMR. You can calculate them now or later.


If you want to do it immediatelly, get it, compile it and install it the usual way via

git pull https://github.com/g4klx/MMDVMCal
cd MMDVMCal
sudo make
sudo make install

Open it it with MMDVMCal /dev/ttyAMA0 and get your values.

The best instruction on how to do this I found on K9NPX’s homepage, though he explains it with the Pi-Star version of MMDVMCal. But there is no difference in how the program works internally and how you need to calculate your values.

Back to MMDVM.ini

I’d turn off all other analog or digital modes exept M17.

[M17]
Enable=1
CAN=0
SelfOnly=0
TXHang=5
# ModeHang=10
[M17 Network]
Enable=1
LocalAddress=127.0.0.1
LocalPort=17011
GatewayAddress=127.0.0.1
GatewayPort=17010
# ModeHang=3
Debug=0

If you do have the OLED-display, set you values here:

[OLED]
Type=3
Brightness=0
Invert=0
Scroll=1
Rotate=0
Cast=0
LogoScreensaver=1

Again pretty, self-explanatory, except the first question: OLED Type: 3 means 0.96″ and Type 6 means 1.3″.

Save everything again with <strg>+<o>.

Now with MMDVMHost the program should start and find your hotspot, but without having M17Gateway yet, M17 does not work yet.

Install M17Gateway

So once again it’s

git clone https://github.com/g4klx/M17Gateway
cd M17Gateway
sudo make
make install

The config file, M17Host.ini, can also be copied to /etc/ to modify it there.

cp M17Gateway.ini /etc/
sudo nano /etc/M17Gateway.ini
[General]
Callsign=G4KLX
# R for Repeaters
Suffix=R
# H for Hotspots
# Suffix=H
RptAddress=127.0.0.1
RptPort=17011
LocalPort=17010
Debug=0
Daemon=0

Callsign is no question, the suffix should be an H for simplex hotsports. Ports and adresses should be left unchanged, if you do not have special requirements.

Also for testing I would recommend leaving daemon at “0”.

In [Info] RX and TX frequencies should be adapted and in

[Network]
Port=17000
HostsFile1=./M17Hosts.txt
HostsFile2=./private/M17Hosts.txt
ReloadTime=60
# Startup=M17-M17_C
Revert=1
HangTime=240
Debug=0

a startup reflector can be activated. Until everything works I would also recomment setting Debug=1.

If you want to be able to change reflectors by a simnple console command, set Enable=1 in [Remote Commands]

Now the time of truth arrives. Open two consoles and start MMDVMHost in one and M17Gateway in the other. If debug is on, you should see them talking to each other, exchanging “pings and pong”.

Setup systemd and make it start automatically on booting

Now its time to make a deep breath, set “daemon=1” in MMDVM.ini and install systemd services.

Create a service

sudo nano /lib/systemd/system/mmdvmhost.service

with the content


Description=MMDVMHost Radio Service
After=syslog.target network.target

[Service]
User=root
Type=forking
ExecStart=/usr/local/bin/MMDVMHost
Restart=on-abnormal

[Install]
WantedBy=multi-user.target

and save it. I know root is questionable at least I was not able to get it done otherwise.

make it executable

sudo chmod 755 /lib/systemd/system/mmdvmhost.service

and create a symlink

sudo ln -s /lib/systemd/system/mmdvmhost.service /etc/systemd/system/mmdvmhost.service

Then you need to create a timer, make it executable again and link it.

sudo nano /lib/systemd/system/mmdvmhost.timer
[Timer]
OnStartupSec=90

[Install]
WantedBy=multi-user.target
sudo chmod 755 /lib/systemd/system/mmdvmhost.timer
sudo ln -s /lib/systemd/system/mmdvmhost.timer /etc/systemd/system/mmdvmhost.timer

And now only the m17gateway.service is missing:

It’s in M17Gateway/systemd, but you can also create it with

sudo nano /lib/systemd/system/m17gateway.service

and copy+paste the content:

[Unit]
Description=M17Gateway Service
# Description=Place this file in /lib/systemd/system
# Description=KC1AWV 07 SEP 2021
After=network-online.target
Requires=networking.service

[Service]
User=root
#Type=forking
Type=simple
#Group=root
Restart=on-abnormal
RestartSec=3
ExecStart=/usr/local/bin/M17Gateway /etc/M17Gateway.ini
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process

[Install]
WantedBy=multi-user.target

I needed to change again the user to root and the type to simple, else in my case it would not work.

Then again

sudo chmod 755 /lib/systemd/system/m17gateway.service
sudo ln -s /lib/systemd/system/m17gateway.service /etc/systemd/system/m17gateway.service

No we need to make systemd learn about the new services, and after a reboot it should load automatically

sudo systemctl daemon-reload
sudo systemctl enable mmdvmhost.timer
sudo reboot

Leave a Reply