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.

4 thoughts on “Beta support for Alinco DX-SR8T in hamlib”

  1. What was the programming cable for exactly? a radio update? or is it required for actually using the DX-SR8 for digital? My apologies, this radio is my main rig and it has been a struggle to get it to work. I do have the hamlib update, but have been unable to get everything functioning together. I have a feeling I am missing something, but knowing you were able to get it running gives me hope.

    1. The cable provides for a serial connection between the computer and the radio. One end is USB and the other is a male TRRS end that plugs into the SP jack. It can be used to program the radio, with the appropriate software, but for my purposes, I wanted the computer to be able to control the radio, such as read the current frequency, activate the PTT, etc.

      It is not strictly necessary for digital. For digital, you need three things: 1) an audio signal from the computer to the radio, 2) an audio signal from the radio to the computer, and 3) a way to trigger the PTT when transmitting. You can do all of that with an audio interface. See my article on what I built for that purpose: https://www.w8wjb.com/wp/2020/06/10/alinco-dx-sr8t-digital-mode-interface/

      With the interface in the article, though, it uses a USB to Serial adapter to trigger the PTT. With this cable, it is possible to eliminate that adapter and instead trigger the PTT via Hamlib.

      In addition to triggering the PTT, I also wanted FLDigi and my logging app to be able to read the current frequency and having a CAT connection to the radio enabled that. This way, if I spin the dial on the radio, the numbers are automatically updated on the computer.

  2. Good job with the Hamlib implementation. To unfortunate I’ve sold the DX-SR8 so I can’t try it. I also have to add that I don’t remember reverse engineering the commands. At least Mikael Q Kuisma on http://whiteboard.ping.se/SDR/DX-SR9 published them before my post.

Leave a Reply

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