Raspbian (Debian) Jessie and TNC-Pi

tnc-piSo, Raspbian has been updated to Debian Jessie;  we’re now in systemd land and the provided instructions from the tnc-pi instructions are no longer relevant.

After installing Raspbian I recommend extending your partition / filesystem to fill the space available on your SD card.  This can be done using the following menu driven configuration utility:-

sudo raspi-config

This utility can also configure the pi to boot into command line only mode rather than the full gui.  This is entirely up to the users preference.

In my case aptitude was already installed.  But if this is not the case for you:-

sudo apt-get install aptitude

Next we need to disable the console in /boot/cmdline.txt (remove the section ‘console=ttyAMA0, 115200’).  This can be done using your favourite editor (in my case vim, although the tnc-pi manual suggests using ‘leafpad’ if using the gui).

As we’re using systemd we no longer have an inittab.  Instead we need to stop and disable the getty service for ttyAMA0:-

sudo systemctl stop serial-getty@ttyAMA0.service
sudo systemctl disable serial-getty@ttyAMA0.service

We’re now ready to install the ax25 tools:-

sudo aptitude install ax25-tools ax25-apps

Edit our /etc/ax25/axports file as per the original manual using our choice of editor; in my case it looks like this (be sure to have no blank lines):-

# /etc/ax25/axports
#
# The format of this file is:
#
# name callsign speed paclen window description
#
1 M0SPN-1 19200 236 2 TNC 1

Then finally kissattach to the serial port.  Using my axports file above I simply issue a :-

sudo kissattach /dev/ttyAMA0 1 10.0.0.10

‘sudo ifconfig’ should then list ax0 with the IP address configured.  We’re good to go!

root@raspberrypi:~# ifconfig
ax0 Link encap:AMPR AX.25 HWaddr M0SPN-1 
 inet addr:10.0.0.10 Bcast:10.255.255.255 Mask:255.0.0.0
 UP BROADCAST RUNNING MTU:236 Metric:1
 RX packets:192 errors:0 dropped:0 overruns:0 frame:0
 TX packets:273 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:10 
 RX bytes:17380 (16.9 KiB) TX bytes:25950 (25.3 KiB)

Finally, I want ‘kissattach’ to run at boot so the ax25 interface (and IP address) are ready to go without requiring operator interaction.  I do this by editing the /etc/rc.local file.  Mine now looks like this:-

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
 printf "My IP address is %s\n" "$_IP"
fi

echo "kissattach 10.0.0.10"
kissattach /dev/ttyAMA0 1 10.0.0.10

exit 0

Additionally, as I’m interested in running TCP/IP over ax25 rather than the standard ax25 tools, I install a telnet server on the pi and enable the service:-

sudo aptitude install telnetd
sudo systemctl enable inetd.service

Also, for debugging I install the telnet client:-

sudo aptitude install telnet

Now, from my main ‘radio’ PC I can simply telnet to my pi:-

steve@radio:~$ telnet 10.0.0.10
 Trying 10.0.0.10...
 Connected to 10.0.0.10.
 Escape character is '^]'.
 Raspbian GNU/Linux 8
 raspberrypi login: pi
 Password:
 Last login: Tue Nov 24 20:36:53 UTC 2015 from 10.0.0.1 on pts/0
 Linux raspberrypi 4.1.13+ #826 PREEMPT Fri Nov 13 20:13:22 GMT 2015 armv6l

The programs included with the Debian GNU/Linux system are free software;
 the exact distribution terms for each program are described in the
 individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
 permitted by applicable law.
 pi@raspberrypi:~ $ id
 uid=1000(pi) gid=1000(pi) groups=1000(pi),4(adm),20(dialout),24(cdrom),27(sudo),29(audio),44(video),46(plugdev),60(games),100(users),101(input),108(netdev),997(gpio),998(i2c),999(spi)
 pi@raspberrypi:~ $ df -h
 Filesystem Size Used Avail Use% Mounted on
 /dev/root 7.3G 3.3G 3.7G 47% /
 devtmpfs 87M 0 87M 0% /dev
 tmpfs 91M 0 91M 0% /dev/shm
 tmpfs 91M 4.5M 87M 5% /run
 tmpfs 5.0M 8.0K 5.0M 1% /run/lock
 tmpfs 91M 0 91M 0% /sys/fs/cgroup
 /dev/mmcblk0p1 60M 20M 41M 34% /boot
 tmpfs 19M 0 19M 0% /run/user/1000
 pi@raspberrypi:~ $ exit
 logout
 Connection closed by foreign host.
 steve@radio:~$

Incidentally, if you do ping machines to check for connectivity and/or audio levels, I suggest you increase the interval to 5 seconds to accommodate the 1200 baud packet TX/RX times.  Anything less than 5 seconds and you’ll get collisions and dropped packets.

steve@radio:~$ ping -c 10 -i 4 10.0.0.10
PING 10.0.0.10 (10.0.0.10) 56(84) bytes of data.
64 bytes from 10.0.0.10: icmp_seq=1 ttl=64 time=2330 ms
64 bytes from 10.0.0.10: icmp_seq=3 ttl=64 time=4629 ms
^C
--- 10.0.0.10 ping statistics ---
4 packets transmitted, 2 received, 50% packet loss, time 12001ms
rtt min/avg/max/mdev = 2330.581/3479.982/4629.384/1149.403 ms, pipe 2
steve@radio:~$ ping -c 10 -i 5 10.0.0.10
PING 10.0.0.10 (10.0.0.10) 56(84) bytes of data.
64 bytes from 10.0.0.10: icmp_seq=1 ttl=64 time=2250 ms
64 bytes from 10.0.0.10: icmp_seq=2 ttl=64 time=2242 ms
64 bytes from 10.0.0.10: icmp_seq=3 ttl=64 time=2244 ms
64 bytes from 10.0.0.10: icmp_seq=4 ttl=64 time=2251 ms
64 bytes from 10.0.0.10: icmp_seq=5 ttl=64 time=2254 ms
64 bytes from 10.0.0.10: icmp_seq=6 ttl=64 time=2247 ms
64 bytes from 10.0.0.10: icmp_seq=7 ttl=64 time=2161 ms
64 bytes from 10.0.0.10: icmp_seq=8 ttl=64 time=2253 ms
64 bytes from 10.0.0.10: icmp_seq=9 ttl=64 time=2247 ms
64 bytes from 10.0.0.10: icmp_seq=10 ttl=64 time=2248 ms
--- 10.0.0.10 ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 45019ms
rtt min/avg/max/mdev = 2161.920/2240.195/2254.368/26.409 ms
steve@radio:~$

I hope this has been useful!  Enjoy your 1200 baud packet 🙂

This entry was posted in Uncategorized. Bookmark the permalink.

6 Responses to Raspbian (Debian) Jessie and TNC-Pi

  1. Nick says:

    Looks great, mate 🙂

    From what I can tell, it’s something to do with the box you picked up from the rally?

    • m0spn says:

      Not directly related, but still packet radio. The TNC-Pi is an awesome little add-on board for the Raspberry Pi, see http://tnc-x.com/TNCPi.htm. This does the job of a hardware TNC/modem although half the functionality is implemented in software on the Pi.

  2. Cory says:

    Hello,

    I have a few questions after watching some of your youtube videos and looking at this post. If had on my TNC-Pi a telnet bbs which is connected to a LAN would be possible to connect via ax.25 to this telnet bbs. I am planning specifically to provide a bbs service which can connect via VHF and over a broadband ham net mesh. Any thoughts you could offer would be much appreciated. The bbs server I am using is called Citadel it has a text based telnet ability as well as a http web server.

    Cheers 73!
    de
    Cory VE3ZCV

    • m0spn says:

      Hi Cory,

      Thanks for the comment. I’ve never looked at Citadel but I can’t imagine you having much difficulty.
      I’d suggest you run ax25d with something like this in /etc/ax25/ax25d.conf:-

      [ VIA ]
      default * * * * * * – root /usr/sbin/axspawn axspawn

      This ‘axspawn’ will provide a normal login prompt (leading to a shell) upon an ax25 connection. You could either use this for authentication, or perhaps replace ‘axspawn’ with whatever login/auth process Citadel requires.

      ‘man ax25d.conf’ is probably your friend. Behaviour can be altered depending on the originating callsign.

      This should at least get you started. Let me know how it goes!

      Steve M0SPN

      • Cory says:

        Thank you kindly Steve, I just ordered the TNC-pi packet modem and I am excitedly awaiting its arrival. When I get it up and running I will be sure to let you know. Love the videos keep up the great work!

        73 De
        VE3ZCV
        Cory

        • Cory Vickruck says:

          Hey Setve,

          I know its been a while but I finally, got it all set up. Thank you very much for your help.

          Cheers,
          VE3ZCV
          Cory

Leave a Reply

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