Controlling The Si5351 Signal Generator From HDSDR
I’ve mentioned a few times that my preferred interface for software-defined radios (SDRs) is HDSDR. I like the way it’s layed out and I especially like how it allows for control of different hardware by simply dropping in a new control DLL.
Ever since I built the previously described Si5351 signal generator, it’s been on my list of things-to-do to write an HDSDR DLL to control it. That only made sense since the whole reason for building the signal generator was to use it as a source when experimenting with various receiver designs. And since I recently received an email asking if just such a DLL was available, I decided it was time to do something about it.
So What Is This Hardware Interface You Mention?
As described in the HDSDR FAQ, HDSDR communicates with hardware through a control module referred to as the External Input Output Dynamic Link Library (ExtIO-DLL). The nice thing about this is the interface for the ExtIO DLL is publicly available. If you have a new piece of hardware you’d like to use with HDSDR, just write a DLL that provides the proper interface, drop it into the HDSDR program directory, and you’re good to go.
Writing the DLL…
If you’ve ever written a DLL for the Windows operating system you won’t have any trouble producing an ExtIO-DLL. The interface description can be found in the specifications available on either the original Winrad page or I2PHD’s WeakSignals page. Of 19 possible entry points, only eight (InitHW, OpenHW, StartHW, StopHW, CloseHW, SetHWLO, GetStatus, and SetCallback) are required.
I had already written a Python library to control the Si5351 so this was the logical place to start. I ported the routines to C and integrated them as appropriate within an ExtIO-DLL project skeleton. Since the required entry points are sufficient to control the Si5351, they’re the only ones I implemented. The source code and precompiled binaries are available from the GitHub repository as a Visual Studio 2008 project. If you’re going to rebuild from souce you’ll also need the libusb-win32 library.
And Using The Hardware
The signal generator uses an Adafruit Trinket with appropriate firmware as a USB-to-I2C interface for the Si5351. When you plug the signal generator into the USB port the first time, Windows will attempt to load a driver once the Trinket gets past its bootloader. The driver can be obtained as part of the original I2CStick project upon which the Trinket firmware is based. Download the zip, extract the driver, and install it as you normally would. The file includes versions for both 32 and 64 bit but I’ve only tested the 64 bit version on Win7.
At this point, drop the ExtIO-DLL from the Visual Studio project (it can be found in the Release or Debug directory, depending upon which you want) into the HDSDR program directory. Start HDSDR as normal and choose the Extio-Si5351 DLL when prompted.
With the DLL as written, the signal generator will produce I and Q signals at the HDSDR local oscillator (LO) frequency on the Si5351 clocks 0 and 1. Since there’s only control for one frequency in the Extio-DLL interface I didn’t bother with clock 2.
Also, even though you can go down to a 0 Hz LO in HDSDR, the Si5351 won’t work that low. It bottoms out somewhere between 1 and 2 MHz so if you’re going lower than that you’ll need some sort of divider circuit.
Finally, while this project was written for the Windows operating system, it could be modified to work under Linux with Wine. This is actually the next improvement I’m looking at since, at least for me. using HDSDR with a Linux native library to control the hardware would definitely be the best of both worlds.