Beta support for Alinco DX-SR8T in hamlib

Alinco DX-SR8T

I own an Alinco DX-SR8T radio as my main HF radio. With the upcoming Field Day, I wanted to have a way to log contacts quickly. I was concerned that I would be spinning the dial and forget to enter the current frequency in the logging software.

A neat feature that a lot of logging apps have is the ability to communicate with your radio. You generally just get the correct cable, connect your computer to your radio, and then your app can talk to the radio and query and control it. This is called CAT control (Computer Aided Tuning/Transceiver) or “rig control”

Rather than every ham radio app having to code their own support for the myriad of different radio models out there, there are software libraries out there that provide a standard API. One of the more popular libraries out there is hamlib.

That is, of course, if your model of radio is on the list of supported radios

Mine, of course, was not on the list.

As luck would have it, though, after scouring the Internet and even emailing the US Alinco distributor (no reply), I found that YO5PTD had posted a blog post with set of serial commands for talking to an DX-SR8/9.

This gave me hope. So, I ordered a cable from eBay.

When the cable arrived, I plugged it in, fired up CoolTerm, and typed in the command to read the frequency from the radio. It worked!

There was a time when I would have opened up the source code to Hamlib, saw that it was coded in C, threw up my hands, and chalked it up to “too difficult for me”. But not anymore; my new philosophy is, let’s just try.

It took almost a week of intense research and coding in my spare time, but, at the end of it, I brought my laptop down to my Alinco radio, plugged it in, and… it didn’t work. 

I couldn’t figure it out. It was sending the correct command over serial, but it was just sending my command right back to me, before it sent back the response. Went back to CoolTerm, typed in the same command, no echo. What’s going on? Then it dawned on me. The reason I could see the things that I type in CoolTerm was not because CoolTerm was giving me an edit buffer before sending the data over serial, but rather it is common practice for the serial device to echo back what is being sent, so that you can see what you’re typing.

The funny thing is, I had looked at the code for the Alinco DX-77 (Which was the only Alinco radio supported by Hamlib. Different protocol, unfortunately) and wondered why there was code in there to read the echoed command and skip over it. I didn’t think my radio did that, so I took it out. Oops.

Once that was back in, eureka!, I could read the frequency from the radio!

But now, the challenge was, this is just a library; I wanted to see it working in a real app. So, I downloaded the Fldigi source code and compiled it myself, but pointed it at my newly built version of the Hamlib library.

And.. it works! When I spin the dial or change modes on my radio, the changes are automatically reflected in Fldigi.

I cleaned up the code and submitted it as a pull request to the main Hamlib code line. It took less than a day for them to merge it in! My code will now be available in all new versions of Hamlib.

I could only support the commands that YO5PTD had reverse engineered, because I don’t know how to discover more commands, but I find that, at least for my needs, it does everything I need it to.

Now we wait for it to trickle down into various ham radio software, as they release new versions that include the new version of Hamlib. However, I did discover that it is possible to run a newly built version of rigctld, and connect to it using the “NET rigctl” model type in Hamlib. In this way, you can get an app that is compiled with an old version of Hamlib to talk to the new version.

Leave a Reply

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