Installing Direwolf and LinBPQ on Raspian Stretch

Jeff KP3FT has written a nice document about the installation of Direwolf and Linbpq on a Raspberry with raspbian Stretch. Download the complet document here.

Dire Wolf

Installing Direwolf and linBPQ on a new Raspian Stretch installation.  It’s a combination from various websites and documentation, condensed down into a straightforward walkthrough.  This doesn’t include configuration of most BPQ settings, only enough to get it to use Direwolf as a modem.

Older Raspian versions like Jessie may require Pulse Audio removed first, prior to installing Direwolf.  Raspian Stretch by default does not have Pulse Audio installed.  My Raspian config settings have SSH and VNC enabled.

First:

sudo apt-get update
sudo apt-get upgrade
sudo reboot now

After it restarts, install libasound:

sudo apt-get install libasound2-dev

Optionally install the following if you want to enable Direwolf to use the GPIO pin on certain USB sound devices for PTT:

sudo apt-get install libudev-dev

Then install Direwolf (as of this writing, version 1.5 is the latest):

cd ~
git clone https://www.github.com/wb2osz/direwolf
cd ~/direwolf
git tag
git checkout 1.5
make -j 
sudo make install 
make install-rpi
make install-conf

Plug your USB sound device(s) into the RPi, open a terminal, and run the following to verify the system sees the USB sound device(s).

aplay -l (the smallcase letter "l", not the number "1")

If the Raspberry pi’s onboard audio is enabled, it will show up as Card 0, Device 0.  The USB sound device should show up as Card 1, Device 0.  A second USB sound device will show up as Card 2, Device 0, and so on.

Open the direwolf.conf file in a text-editor, scroll down, and enable the correct USB sound device by removing the # at the beginning of the appropriate line.  For example, on mine it is:

ADEVICE  plughw:1,0

Scroll down and change “N0CALL” to your callsign in the line:

MYCALL N0CALL

Enable the modem speed you want.  In my case, I enable 300-baud:

MODEM 300

Scroll down and enable the appropriate PTT option for your setup.
Further down, enable and change the AGWPORT and KISSPORT settings for your setup.
Optionally disable all the APRS-related lines if you don’t want to use those functions.

Save the file and run Direwolf by double-clicking the desktop icon, or test-run it from Terminal with:

cd ~
direwolf

You should see packet activity if the radio is tuned on the right frequency and audio level is good.

Close Direwolf for now (CTRL-C) and install pilinBPQ (skip down to the Direwolf port section if pilinBPQ is already installed):

sudo mkdir linbpq
cd linbpq
sudo wget http://www.cantab.net/users/john.wiseman/Downloads/Beta/pilinbpq
sudo mv pilinbpq linbpq
sudo chmod +x linbpq
sudo su
setcap "CAP_NET_ADMIN=ep CAP_NET_RAW=ep CAP_NET_BIND_SERVICE=ep" linbpq
su pi
sudo mkdir HTML
cd HTML
sudo wget http://www.cantab.net/users/john.wiseman/Downloads/Beta/HTMLPages.zip
sudo unzip HTMLPages.zip
cd ~/linbpq
sudo mkdir BPQAPRS
cd BPQAPRS
sudo wget http://www.cantab.net/users/john.wiseman/Documents/Samples/APRSHTML.zip
sudo unzip APRSHTML.zip
cd ~
sudo chown -R pi:pi linbpq

Copy an existing Linux bpq32.cfg from another source to /pi/linbpq. I have an old bpq32.cfg file here which would need some substantial editing for your own setup:

https://www.qsl.net/swlkp3/Packet/bpq32(Linux).cfg .

Be sure to rename it to bpq32.cfg .If you don’t use the above bpq32.cfg file, and add one or both of these Direwolf ports in the ports section of whatever copy of bpq32.cfg you have, depending on how many Direwolf modems you want to run.  Change the port numbers to whatever works with your particular setup.  The timing settings can also be changed; these are what worked with my setup for 300-baud HF packet and 1200-baud VHF packet.

;******PORT 1 Direwolf 300-baud*****
PORT
   PORTNUM=1                 ; Port number
   ID=HF Packet 300-baud     ; PORTS command text
   TYPE=ASYNC                ; RS232 connection
   IPADDR=127.0.0.1          ; DIREWOLF
   TCPPORT=8001              ; DIREWOLF
   SPEED=19200
   CHANNEL=A                 ; TNC channel
   MAXFRAME=1                ; Max outstanding frames
   FRACK=5000                ; Level 2 timeout (ms)
   RESPTIME=40               ; Level 2 delayed ACK (ms)
   RETRIES=10                ; Level 2 max retries
   PACLEN=40                 ; Max packet length (bytes)
   TXDELAY=100               ; Transmit keyup delay (ms)
   SLOTTIME=100            ; CMSA interval timer (ms)
   TXTAIL=30
   PERSIST=63     ; Persistence (256/(# transmissions-1)
   DIGIFLAG=1       ; Allow Digipeat on this port
ENDPORT
;****** PORT 2 Direwolf 1200-baud *****
PORT
   PORTNUM=2                 ; Port number
   ID=VHF Packet 1200-baud   ; PORTS command text
   TYPE=ASYNC                ; RS232 connection
   IPADDR=127.0.0.1          ; DIREWOLF
   TCPPORT=8003              ; DIREWOLF
   SPEED=19200
   CHANNEL=A                 ; TNC channel
   MAXFRAME=1                ; Max outstanding frames
   FRACK=5000                ; Level 2 timeout (ms)
   RESPTIME=40               ; Level 2 delayed ACK (ms)
   RETRIES=10                ; Level 2 max retries
   PACLEN=236                 ; Max packet length (bytes)
   TXDELAY=100               ; Transmit keyup delay (ms)
   SLOTTIME=100            ; CMSA interval timer (ms)
   TXTAIL=30
   PERSIST=63     ; Persistence (256/(# transmissions-1)
   DIGIFLAG=1       ; Allow Digipeat on this port
ENDPORT

Save the file.

Start Direwolf.

Open another Terminal and start linBPQ:

cd ~/linbpq
sudo -u pi ./linbpq

It should connect to Direwolf(s) on port 127.0.0.1:8001 or whatever port(s) you set up.

Notes:
——
Multiple instances of Direwolf can run at the same time.  Each instance has its own “.conf” file.  Each conf file needs to be edited to enable whatever port and USB sound device will be used.  To do that, just edit the original “direwolf.conf” file and save it under a new name, such as “direwolf_HF.conf”, etc.  Start each instance in Terminal using the “-c” switch to point Direwolf to the correct “.conf” file.  In my setup, I start the first Direwolf instance in Terminal with “direwolf -c direwolf.conf”.  The second instance is started in another Terminal with “direwolf -c direwolf_HF.conf”.

Direwolf has several options that can be used in the command line.  Three that I find particularly useful are the “-q”, -T”, and “-x” options.  By default, Direwolf shows audio in/out levels in its Terminal screen.  This can be turned off with “-q h”.  For example, when I run my HF 300-baud instance of Direwolf to disable audio reports, I run “direwolf -c direwolf_HF.conf -q h”

To show timestamps of sent and received packet frames, use the “-T” option with “%H:%M:%S”.  Example: “direwolf -c direwolf_HF.conf -q h -T %H:%M:%S” to disable audio reporting and show timestamds in hours-minutes-seconds format.

The “-x” option immediately starts Direwolf transmitting calibration tones, which I use mostly to key the transciever for tuning the antenna when I switch bands.  Example: “direwolf -c direwolf_HF.conf -q h -T %H:%M:%S -x”.  Enter CNTRL-C to stop the transmit.

The complete list of command-line options are in the Direwolf user guide, pages 126 through 128: https://github.com/wb2osz/direwolf/tree/master/doc

Debian wheezy LTS

It looks like I’m going to get into trouble if I keep using Wheezy. There will probably be no security updates after May 31, 2018, any more. Maybe I should switch to Jessie. Or perhaps Stretch. There is even a newer version “Buster” (Alpha 1). I think Jessie can be a good choice.

LTS stands for Long Term Support.

However, I do not like the idea that Wheezy sees the end of his life.