18 April 2014

RoundUp : Installing Ham Radio Software on an ArmHF Based Cubieboard

This post will not concentrate on a HowTo implement, but on HowTo find your way to implement Ham Radio Software. For details, please have a look at the various topics I covered in the last week. Of course you will get a list of what I managed to get it running. The main difficulties I ran in, were not about finding and implementing but how to combine different parameters with another.





Hardware

In the first moment this is an easy question: You take what you have. So my first steps were done with a Raspberry Pi and I was astonished how well it performed until I tried different things not written in these various books describing the initial steps. It was clear that it was no power horse. Used to bigger Linux machines I got nervous waiting for the Pi to sort things out. Of course the CPU could be overclocked, but that didn't solve the real problem. Next I tried to add some screen and noticed, that this was not a plain vanilla operation. These were dedicated operations which afforded to change the kernel and other things.

So it was a logical solution to use a faster machine with more memory and another architecture: the Beaglebone Black (BBB). I was astonished how fast operations went. The armhf supports hard floating ports, but when memory is limited you will run into problems. So I use the BBB as my communications center running from a SD-Card and have no problems

Next came the Cubieboard 3 (CubieTruck) and indeed speed problems were solved. I have enough memory so that the swap space is seldom used and I installed the system on a big SD-card.

~# lscpu

  • Architecture:          armv7l
  • Byte Order:            Little Endian
  • CPU(s):                2
  • On-line CPU(s) list:   0,1
  • Thread(s) per core:    1
  • Core(s) per socket:    2
  • Socket(s):             1

So if you got money to spare use the Cubieboard but you can work with the BBB the same way but have to deal with some memory restrictions. This is not a real problem, if you want to use the computer with only a few dedicated programs.

And use a SD-Card as big as you can afford. No use two SD-Cards and make a clone of the actual one. Just in case something goes wrong. The size of the SD-Card? I start with at least 16 GB, so I don't have to think about when installing new software. In the moment I started with a blank Linux system with about 25 000 files taking about 1.5 GB. Now I have over 120 000 files and 4+ GB. Who cares? There is enough place left.

Additional Hardware

An important point BEFORE you start to use programs. I you are just poking around it doesn't matter, but when you want to use the software, better think before.

As already written nearly all software has to connect with your hardware. And this has to be done in two ways:

  1. Sound (receive and transmit) 
  2. Control TRX
I have a cheap but new Logiclink USB soundcard which works with (nearly) all programs and Linux sound systems. So before you ask yourself where the sound vanishes have a look at this USB Soundcard Test Site. You will save hours of searching for unnecessary bugs.

Connecting your machine is easy as 1,2,3 if you know what you do. But the problems could be manifold:
  • Setting / Finding the right port
  • Converting from USB to TTY/ RS232
  • Setting the right communication parameters (Baud, Bits, ...)
Please be sure that you know your way from a known computer to your dream dx-machine.

I use an old Signalink converter, which keeps me out of troubles if I set he cables right.

 When it comes to SDR there seems to be no question which hardware to choose: A DVB-T dongle. It is cheap and it kind of works. It has a kind of sound card on board, but  I have put the DVB/T stick back on the shelf. They may be nice if you are working with broadband (e.g. FM) transmissions were the S/N ratio is significantly high. For all other protocols especially WSPR there is a physical barrier. You don't not have any LPF or BPF. So all modulations from the receiver, computer and bands are within your pass-band. The noise level is very too high on hf. When you consider that the signal in WSPR could be -30 dBm under the noise level and you have no control of the digital filters of hardware and software (noise blanking e.g.) you must be very lucky to find a signal or the beacon is blowing his signal like good old VOA.

So better get a SDR with conventional pre-band filtering and that costs a lot. My solution is a mid range SDR, the PMSDR  and use it as a pan adapter to my K2. So I have before the signal gets to the SDR and later to the sound card a filtering with LPF and BPF. I get a "clean" spectrum which can be used for further processing. Of course the best way would be a Perseus, with a 3-pol-LPF (0 - 1,7 MHz) and 9 x 6-pol BPF (1,7 - 30 MHz) but ...

Operating System

I am not talking about taste and experience. I went to find out the hard way which system was good on the armhf architecture concerning amateur radio software.

Android
This would have been my first choice. It runs on phones and tablets. It is stable and there are hundreds of apps which can be used by a ham. Fine if it would work on these little devices which I own. To make a long story short: I did only find ONE implementation which kind of worked, but I could not connect the the Google Play Market.

Ubuntu and derivatives
Time and again I use this flavor on my normal machines. It looks like Windows, the Linux part is hidden and there are some pre compiled software packages for the radio amateur, which could be installed right out of the box. Well done, but it wouldn't help you with your Cubie. These packages are compiled for Intel or compatible CPUs. So better go to the source. Debian is the mother of Ubuntu.

Debian
Of course you have the same problem with Debian: Pre-compiled versions of software (*.deb) are found everywhere, but that's a no go for you. You have to find compiled versions for the armhf architecture. And here A BIG APPLAUSE for the developers who cross compiled their newest library, program, ... also for the searched CPU. Without theses guys and girls, I would be nothing, at least concerning the BBB and CubieBoard ;-)

General Software
Please help yourself and read the books or find your way. But some software packages were needed all the time. But first look that your system is reasonable safe. After setting up the system I followed the ideas of FreedomeBone.  So that later you don't have to search for leaks, wholes and unwanted contributors.

For the ham software you will need some sort of a xWindow system. Choose one which uses the least resources. I am using the LXDE Desktop. Not beautiful, but working. But don't forget to enable ssh. I do my work to 90 % with ssh on the terminal.

You need an editor: I use emacs, nano and leafpad and iceweasel as browser. Additionally you will need python 2.7, svn and git depending on the software. Usually I install Debian LAMP (apache, mysql,  php and phpmyadmin) I need it for my other projects.

Software Installation
As told before I will not give you a step by step installation instruction. This is senseless. Developers are interested in their software and will develop and correct bugs. So normally the software will change sometimes on a daily basis. So will the dependencies. Libraries will evolve and mature and I can not follow this in a timely manor. On the other hand have a look when the last release was launched. When it is older then 2 years ... you never know. Perhaps the programmer has found something new or found his idea not worth to develop further. RTFM.

  1. Find the software you want to install.
  2. Read the manual to find the external and internal dependencies
  3. Check if you have all hardware involved
  4. Check if your computer is up to the task. When the developer says we need a 1.5 GHz CPU, you can try it. If he says you will need a triple core at 2.5 GHz you can try, but ...
  5. Find the sources. If there are pre-build packages check if they are compiled for the armhf architecture. If not, forget it.
  6. Run apt-get update, apt-get install xxx. If you are lucky the wanted software is installed, for your system checks if it will run on your system. Then you are done and you have to RTFM.
  7. Look on the site of your software for the sources( *.tgz or *.bz7, ...)
  8. Rune apt-get update.
  9. When found you are a lucky one when not, you have to DIG DEEPER see below.
  10. Make a fresh directory in your home directory "mkdir build".
  11. Change into that directory and download the software. I often download the software on my normal Linux system and make a secure copy to the Cubie" scp xxx.tgz hjd@192.168.1.xxx:/home/hjd/build"
  12. Unpack the software with tar, git svn or whatever the software demands for.
  13. RTFM, read the README, read the INSTALL, read ...
  14. Again, before you proceed RTFM for you will certainly find the libraries the software depends on.
  15. Do not make a "apt-get install xxx, yyy, zzz,  ..."
  16. Check each library after another and install them, so that you have some sort of control what is working and what is not. When installing additional software use apt-get or aptitude or ... These programs will look that the libraries, which your library depends on is installed. If not it will tell you. Read the messages. You must not understand everything. A warning is a warning, but an error is a no go.
  17. If you do not find the library, you have to DIG DEEPER see below.
  18. When all the dependencies have been fulfilled, you can start to build the software described in the README.
  19. You have to "./configure" it for your system. Again, when something is missing or gone wrong: First repair it before you continue.
  20. You have to "make" it. This can take a while, but watch out for errors. The have to be fixed. Warnings ... I tend to forget them.
  21. When everything has ended in a normal way, root has to  "make install" it into the right directories where you are not allowed to enter or write.
  22. You are done, when the RTFM says so.
Well Done!

Software Installation DIG DEEPER

Now comes the fun part when you can trash your whole system. (Once in your life you have to do it. Why not now?)
You can do it everyday, but the chances are now bigger. So if you haven't done it:

  • Copy your relevant data to another system
  • Or make a clone of your SD card using dd.
  • Or better: Build a system without relevant data just for testing purposes. I think that is the safest way. 
Debian comes in three releases:
  • stable:  the latest officially released distribution of Debian -  called "wheezy"
  • testing: packages which are on the way to be stable - called "jessie"
  • unstable: you name it - called "sid"
When you get an image of Debian you are normally directed to look up only the contents of the stable release. You will find that information (as root) in the file:  "/etc/apt/sources.list"

And it will look something like:

deb http://ftp.de.debian.org/debian stable main contrib non-free
deb http://ftp.debian.org/debian/ wheezy-updates main contrib non-free
deb http://security.debian.org/ wheezy/updates main contrib non-free
But hams like to invent new things which are far from being stable or at the end of their development. They are hidden for normal users in the other two releases:
# deb http://ftp.de.debian.org/debian/ jessie main
# deb http://ftp.de.debian.org/debian/ sid main
And this is the place I looked for and found most of the missing pieces of software. Or in other words: Without these releases I would not have been able to build most of the software listed below.

So do the following, but you are warned and on your own:

  1. Make a Google search for YourSoftware on the Debian packages page.
  2. Look hard that you found exactly YourSoftware
  3. Look for the hardware it was compiled for: armhf 
  4. Look for the release.
  5. When the release is wheezy, you have done something wrong. If it is found e.g. in jessie do the following:
  6. Become root and edit with your favorite editor the file /etc/apt/sources.list
  7. Add the line: deb http://ftp.de.debian.org/debian/ jessie main
  8. Save the file and don't shut the terminal and editor
  9. Open another terminal and type: "apt-get update"
  10. Do NEVER EVER apt-get upgrade
  11. Do apt-get install YourSoftware
  12. When done go to your other terminal window.
  13. Become root and edit with your favorite editor the file /etc/apt/sources.list
  14. Add a '#' before the line:  deb http://ftp.de.debian.org/debian/ jessie main
  15. Save the file
  16. Type "apt-get update"
  17. And you are done - for the moment for your missing YourSoftware is installed and your system is back to normal.

END OF DIG DEEPER

Ham Radio Software

Now to the list of software which I was able to install and which runs (nearly) without problems. Most of it will rest and out of various reasons not be used for it doesn't interest me. But it could be interesting to you


  • ntp: nearly the most important software for a lot of programs. It synchronizes your machine with a time server of your choice. I use some internet servers and it works fine for e.g. all of K1JT software.
  • hamlib: A lot of programs depend on that library. It is an interface to your radios.
  • K1JT Software: Like 
  • wsjt
  • wsjt-x
  • map65
  • wspr.   These programs were the motivation to start that travel through BeagleBone and CubieLand. (See my other articles for details.) If you follow closely the instructions, they all can be compiled on the armhf machines. But again RTFM and look for missing libraries in the other Debian releases. I even compiled wsjt revision 1938 which has a WSPR-QSO mode included. But more about that later.
  • CQRLog: These is a complete logging program which stores the QSOs in the myqsl database. I never figured out how they managed to find the root password of mysql. I managed to import an *.ADI file from my other log. I haven't get used to it. I still weep after my UCX-Log, which has not been proted to Linux.
  • Xlog: A simple but working logging program, easy to install and works right out of the box. Import of *.ADI file was without problems.
  • Voacap with PythonProp: This is a prediction program which works with proper care very well.
  • Fldigi: A powerful software to analyse digital signals. It works with a narrow bandwidth, so that you can use the internal soundcard. It can be connected with a lot of other programs. It is able to decode CW,  Domino, Feld, MFSK, PSK, OLIVIA, RTTY, Throb, ... But as always, You have to know what to do and where to look. I must confess, that I was seldom successful in using this software, but give me some time. 
  • Predict: "a real-time satellite tracking and orbit prediction application", wonderful to look at, but I have not the right antennas nor the equipment to connect to the outer world. A pity.
  • glfer: A spectragram for the QRSS-fan. So if you run the Ultimate 3 not in WSPR mode. This program is made for you - if you are sitting on the other side.
  • GNUradio: That's a real DIY SDR Kit: I will dig into that deeper. For now let me cite: GNU Radio is a free & open-source software development toolkit that provides signal processing blocks to implement software radios. It can be used with readily-available low-cost external RF hardware to create software-defined radios, or without hardware in a simulation-like environment. It is widely used in hobbyist, academic and commercial environments to support both wireless communications research and real-world radio systems.

  • grig :A simple CAT program based on hamlib (see above)
  • SDR-J: A complex SDR program which looks nice but is nearly over the top of the CubieBoard. It kind of runs, but there are few resources left and I haven't managed to get it working with my PMSDR
  • linrad: Seems to be the best SDR program I found. The problem is manifold. The armhf boards haven't got enough power to drive it all. The only program which I have still kind of running is Linrad, but I still have to struggle with the parameters. There are a lot of them and I have them not mastered --- yet taking the PMSDR as input for I/Q.
  • rtl-sdr: The SDR program for working together with a DVB/T dongle. It works, but it was due to the hardware not interesting for me.
  • gqrx SDR: Another SDR program. No chance to get it working with my PMSDR.
  • quisk:  See above.
  • flarq: File transfer with digital modes. Haven't used it.
  • linpsk: PSK31 for Linux
  • QTHid: Haven't got a funcube. But the program is a controller for this hardware.
  • QSSTV: SSTV for Linux. Haven't used it - never used SSTV, sorry, but it works on the Cubie.
  • xastir: Mmmh, near Tuebingen APRS seems to be an unknown word.
So that's all folks. A lot of ground covered. One last word for the people who think that wine will be the solution for the rest of the windows software. The wine people did and do a wonderful work if you are working with a x86 processor. It will translate all the complicated Windows commands to generic x86 assembly language, so that you can use windows software under linux, but the armhf CPU has another kind of assembly language. You need another translator: qemu. and two translations, that's too much for the Cubieboard.


That was Fine: Just Intonation. Want another one?



That's my other hobby ;-)

Find Your way and Stay Tuned!