From XastirWiki
Jump to: navigation, search

Setting up Soundmodem on Linux

What the heck is "Soundmodem"? Well, it's a software driver for Linux (can also be used on Solaris and perhaps others) which turns soundcard hardware into a software TNC. You can use many plug-in soundcards, including ISA, PCI, USB, or even most motherboard sound hardware to do this. If you're familiar with AGWPE for Windows, soundmodem is similar in many respects but was written much earlier.

With the Soundmodem driver you only need connect a few cables between your soundcard connectors and your radio, plus perhaps a small cable and/or circuit from another port for push-to-talk capability, and you're able to send/receive packets at whatever baud rates and protocols the software can accomplish. Note that if you don't use a separate pin on another connector, such as a serial handshake pin or a parallel port pin, you'll need to build a VOX circuit in order to key your radio.

There are two methods to configure Soundmodem on Linux:

  1. As an AX.25 kernel networking device. Multiple programs can use the device at once.
  2. As a serial KISS TNC. Only one program may use the device at a time.

If #1 you'll have a port name like "sm0". It appears to the system like an ethernet or wireless networking port and you may need to tell some system daemons not to use it. Once the port is created and configured you create an "AX25 TNC" interface in Xastir to talk to it. Multiple programs may use the device at a time, just like any other networking port, which can be problematic. It requires a bit more setup and care than option #2.

If #2, then use the "Serial KISS TNC" interface type in Xastir. This is the easiest to set up but only allows one program at a time to use it. The port appears as if it's a KISS TNC on a serial port, but the serial port is named "/dev/soundmodem0" instead of something like "/dev/ttyS0" in this case.

Here's where we diverge based on whether we're creating a Serial KISS device or an AX.25 kernel networking device with soundmodem. Note: It's possible to create more than one top-level device, then switch between AX.25 and Serial KISS devices. I created one device called "KISS" and another called "AX25", then could switch to either from within Xastir without reconfiguring or restarting soundmodem.

Setting Up SoundModem as an AX.25 Kernel Networking Device

  • su (become root)
  • /usr/bin/soundmodemconfig (install with your package manager if you don't have it)
  • File->New->Configuration
  • Configuration Name "AX25"
  • Double-click on "AX25"
  • Tab IO:
    • Mode: "soundcard" or "alsa"
    • Audio Driver: "/dev/dsp"
    • Half Duplex (selected)
    • PTT Driver: Choose one of the options (e.g. /dev/ttyS0 if the PTT is triggered through the first serial port)
  • Tab Channel Access:
    • TxDelay: "150"
    • Slot Time: "100"
    • P-Persistence: "40"
    • Full Duplex: (Not selected)
    • TxTail: "10"
  • File->New->Channel
  • Double-Click on "Channel 0"
  • Tab Modulator:
    • Mode: "afsk"
    • Bits/s: "1200"
    • Frequency 0: "1200"
    • Frequency 1: "2200"
    • Differential Encoding: (selected)
  • Tab Demodulator:
    • Mode: "afsk"
    • Bits/s: "1200"
    • Frequency 0: "1200"
    • Frequency 1: "2200"
    • Differential Decoding: (selected)
  • Tab Packet IO:
    • Mode: "MKISS"
    • Interface Name: "sm0"
    • Callsign: "K7ABC" (change to match your callsign, and yes it is okay to use the same callsign for multiple radios during testing)
    • IP Address: "10.0.0.1" (we use 10.0.0.1 just as an example; use any local IP address that makes sense for your network, and use a different address if you are setting up more than one radio)
    • Network Mask: "255.255.255.0"
    • Broadcast Address: "10.0.0.255"
  • File->Quit (this saves the configs, really)

"soundmodemconfig" writes configs to /etc/ax25/soundmodem.conf.

Bulbgraph.png Note: You may wish to turn down your volume in case some TCP/IP packets get routed to the soundmodem interface after it starts up!

Edit /etc/ax25/axports to add a line similar to that shown below but change the callsign to match your callsign:

  • sm0 K7ABC 4800 256 7 144.39 APRS (1200 bps)

To start up the device: As the root user run:

  • /etc/init.d/soundmodem start

(Or on Debian distributions which don't have an init.d entry, run "soundmodem" manually).

Bulbgraph.png Note: Xastir has to be set up "suid root" in order to use ANY AX.25 kernel networking ports. To set the proper permissions for Xastir:

  • su (become root)
  • chmod 4755 /usr/local/bin/xastir
  • exit (from root)
  • Restart Xastir

Within Xastir:

  • Make sure Xastir was compiled with AX.25 support (Help->About)
  • Interface -> Interface Control
  • Add -> AX25 TNC
  • AX.25 Device name: "sm0"
  • Click "OK"
  • Click on the interface to highlight it and press "Start"
  • Check the xterm you started Xastir from for any error messages about the port.

Setting Up Soundmodem as a Serial KISS TNC Device

  • /etc/init.d/soundmodem stop (if soundmodem is still running)
  • su (become root)
  • /usr/bin/soundmodemconfig
  • File->New->Configuration
  • Configuration Name "KISS"
  • Double-click on "KISS"
  • Tab IO:
    • Mode: "soundcard" or "alsa"
    • Audio Driver: "/dev/dsp"
    • Half Duplex (selected)
    • PTT Driver: Choose one of the options
  • Tab Channel Access:
    • TxDelay: "150"
    • Slot Time: "100"
    • P-Persistence: "40"
    • Full Duplex: (Not selected)
    • TxTail: "10"
  • File->New->Channel
  • Double-Click on "Channel 0"
  • Tab Modulator:
    • Mode: "afsk"
    • Bits/s: "1200"
    • Frequency 0: "1200"
    • Frequency 1: "2200"
    • Differential Encoding: (selected)
  • Tab Demodulator:
    • Mode: "afsk"
    • Bits/s: "1200"
    • Frequency 0: "1200"
    • Frequency 1: "2200"
    • Differential Decoding: (selected)
  • Tab Packet IO:
    • Mode: "KISS"
    • File: "/dev/soundmodem0"
    • Unlink File: (selected)
  • File->Quit (this saves the configs)

"soundmodemconfig" writes configs to /etc/ax25/soundmodem.conf.

To start up the device, as the root user run:

  • /etc/init.d/soundmodem start

To stop the device:

  • /etc/init.d/soundmodem stop

From within Xastir:

  • Interface -> Interface Control
  • Add -> Serial KISS TNC
  • TNC Port: "/dev/soundmodem0"
  • Do _not_ choose "Full Duplex" or "Init KISS Mode on Startup"
  • Click "OK"
  • Click on the interface to highlight it and press "Start"

Diagnostics

In soundmodemconfig, if you highlight "Channel 0", you'll see a new "Diagnostics" menu option appear. This allows you to bring up a various screens to adjust and verify proper operation. In order to use these options you must do this:

  • /etc/init.d/soundmodem stop
  • soundmodemconfig
  • Double-click on Channel 0
  • Diagnostics

I have used the Scope option in the past and found it useful for adjusting the mixer settings. If you see no activity with "Scope" or with "Spectrum Display", then "soundmodem" is not getting audio from your radio or microphone. Start playing with various mixers and mixer settings until you _do_ get activity on these displays.

You'll need to set the audio drive level and the TXD settings for soundmodem carefully so that your transmitted signal has the proper deviation. The link below has some wonderful info about setting deviation for packet TNC's:

Problems accessing the port

Some people have found that they can't get Xastir to open the port unless they run Xastir as root. This is a bad idea: It's a security risk running anything as root, as well as being bad practice.

Instead consider doing "chmod 4755 /usr/local/bin/xastir" as root, which makes adds SUID ROOT permissions to the Xastir executable. Xastir has been written to drop to regular user permission except when it's manipulating ports, so it's much safer than running Xastir as root all the time. SUID ROOT is required in order to open AX.25 networking ports, but not for serial KISS TNC ports.

Another even safer method if you're running Soundmodem as a KISS TNC is to set the permissions on the /dev/soundmodem0 file so that anyone can read/write the file, or add your user to the same GROUP as the /dev/soundmodem0 file is configured to use. One of these should get you around the permissions problem.

For reference, here's what /dev/soundmodem0 (Serial KISS TNC mode) looks like: lrwxrwxrwx 1 root root 11 2009-05-20 15:54 soundmodem0 -> /dev/pts/25

And here's the device it points to: crw--w---- 1 archer tty 136, 25 2009-05-21 13:50 25

As you can see, the device is read/write by the owner "archer" and a member of group "tty", but the group only has write privileges, not read privileges.

For the other configuration, AX.25 kernel mode device, the Xastir executable _must_ be owned by root and set to SUID ROOT before it can open the port, or else run by the root user directly (that last is a _bad_ idea for reasons of security).

USB Soundcard Dongles

This section derived from a posting by Dave Platt, AE6EO, with his permission.

I've been able to make a soundmodem 1200-baud connection using a SignaLink USB (setting the soundmodem PTT to /dev/null, since the SignaLink USB has its own vox-driven PTT circuit).

Some tricks:

  • If possible, use the direct ALSA "hw:" interface, and set the soundmodem's sample rate equal to one of the "native" rates supported by your USB sound card. This ensures that no DSP- or CPU-based sample rate conversion needs to be done.
  • With some USB sound cards this may not be possible... there are those which have *different* sample rate sets for input and output, and might not even have a single rate in common which works in both directions. In this case, specify the ALSA "plughw:" interface, so that ALSA's sample-rate conversion plugin does the necessary rate conversions... it seems to work quite well.
  • Do *not* use the OSS compatibility driver for ALSA (e.g. the /dev/dsp interface). Although this driver does attempt to perform sample-rate conversion, it doesn't do so at all well... I've seen periodic dropouts in the incoming data (sequences of sample values of zero) whenever the buffer wraps around. This really mucks up digital modes!
  • Make sure you've got the most recent version of the soundmodem code (it looks as if it's up to version 0.13). There were some important patches to ALSA support a few months ago, which eliminate a bunch of errors and freezes during TX/RX switching... versions 0.10 and earlier did not work well with ALSA USB.

Further info

  • man 8 soundmodem
  • man 9 soundmodem
  • man soundmodemconfig
  • man 8 smdiag
  • man 9 smmixer
  • man 9 baycom
  • /usr/bin/soundmodemconfig

Soundmodem Links

AX.25 Links