A place to document and share things I do

Control your MTR2000 through the STM32-DVM-MTR2K

Using the Aux I/O card capabilities for remote, software control of the station with wildcard and GPI.

When the STM32-DVM-MTR2K V2.0 came out, I emulated most of the features of the Auxiliary I/O card (CLN6698) with the help of an ATmega328 microcontroller. This enabled all 4 station GPOs (General Purpose Outputs) and 4 of the 8 GPIs (General Purpose Inputs) in hardware. I published an API for communicating with the I/O processor, but as far as I know, nobody has ever really picked it up and done much with it.

A user recently asked me if there was a way to disable digital modes and turn on the analog mode (built-in repeat) on the station for special events? To be clear, this is a user who normally runs a single digital mode and does not run analog at all, but would like to a few times a year for events.

I always recommend using the in-station repeat function if you want the station to run in analog single-repeater applications if you can live with the basic functions it provides because it simply sounds better than anything else.

I didn’t want to write an application ONLY for this purpose, but it gave me a good excuse to FINALLY write an application to manipulate the 4 software-controlled GPIs and an article about using this feature.

I will include this handy little Python program in future versions of the OS image for the NanoPi NEO, but that doesn’t help folks who already have a functional system. I had to zip it to get WordPress to accept it as a “media” file, so make sure to rename it gpi_set.py after you unzip it; I recommend running it as the mmdvm user and keeping it in the mmdvm user’s home directory (/home/mmdvm). Here’s a screenshot of the help output, which should be pretty self explanatory:

help output for gpi_set.py
set_gpi.py help output

As the help indicates, the program can be used with no arguments to see the current state of the 4 software GPIs, as you can see here:

gpi_set.py without arguments
gpi_set.py without arguments

It can be used to set or clear a single GPI, like this:

gpi_set.py clearing a single GPI

Or it can be used to set/clear multiple GPIs at a time by entering more GPI/value pairs on the command line:

set_gpi.py setting and clearing two GPIs in one command
gpi_set.py setting and clearing two GPIs in one command

There it is – it’s really that simple. Note I’m using it as a direct executable, which should work on your system if you set the file as executable (chmod +x gpi_set.py). But you can also invoke it with “python3 gpi_set.py” as well. But what about the original application? That’s the easy part. I added a single wildcard table that acts on GPI9. If you’ve not used these features before, you’ll notice I discovered that the logic levels of the GPI appear reversed – which I could have “fixed”, but left to ensure that the “rest state” stayed at a logic level 0 going into the station. An image of the wildcard table in the MTR2000 CPS is shown below:

Knockdown/Setup on MTR2000 GPI9
Knockdown/Setup on MTR2000 GPI9

And really, that’s all there is to it. When GPI9 is “set” (thats ON or a logic 1) the internal controller of the MTR2000 is “setup”, or if you don’t speak Motorola, that’s “enabled”. When GPI9 is “cleared” (that’s OFF or a logic 0), the repeater is “knockdown”, or if you don’t speak Motorola, that’s “disabled”. Because in the application presented to me, the repeater would not normally have analog enabled, and the GPI state won’t restore after a power cycle, I chose to specifically take action to enable it, as the default value for the GPI is cleared.

So in this case, the control operator logs in and types:

python3 gpi_set.py 9 1

to enable analog repeat. And then:

python3 gpi_set.py 9 0

to disable it again.

Have any Question or Comment?

2 comments on “Control your MTR2000 through the STM32-DVM-MTR2K

This works great for turning the internal analog controller on and off. Is there a Wildcard action that can turn the digital side off and on?

When we turn analog on for an event, digital users can still interrupt.

I can brute-force it by killing MMDVM and YSFGateway, but that seems a bit barbaric…

Cort Buffington

The wildcard is a function of the MTR2000 station. The station has no concept of the digital modes, thus cannot be turned off and on through the wildcard. “systemctl stop mmdvmhost” is by no means barbaric.


Leave a Reply

Your email address will not be published. Required fields are marked *