Adjusting KISS TNC AFSK tx level using an isochronous test packet

This post explains a technique to drive a KISS TNC with a specially constructed packet that contains an ISOCHRONOUS test packet, a packet that will produce equal high and low tone alternation in the transmitted AFSK signal.

F0000TEK

Above is the waveform recovered from a receiver without de-emphasis (a Motorola R2009D communications analyser in this case).

The isochronous test packet comprises a KISS frame byte (0x0c), a command /address byte (0x00), a large number of 0x77 bytes which will result in equal alternations of high and low tone per byte or 150Hz rate (due to the NRZI encoding), and finally another KISS frame byte (0x0c). Some equipment contains the ability to send 600Hz isochronous test signals, but the lower rate of 150Hz was chosen to make measurement of the level of the 1200Hz tone easier as four cycles will be contained in the burst.

The packet used in this article contained 753 characters, and takes 5s to send at 1200bps, allowing a fairly steady signal for display on a scope. The test packet is included in the zip package linked at the bottom of the page.

The video above demonstrates the procedure using a Motorola R2000D communications analyser (which does not have de-emphasis).

kissiso01

Above a still from the video of the recovered modulation.

This can be sent to the TNC from a DOS command shell, or *nix shell after setting the serial port parameters.

The following is a DOS batch file which loops sending the packets. The sleep command is not part of DOS, it is the GNU sleep command ported to W32 and is included in the zip package linked at the bottom of the page. Of course, you must edit the com port setting to suit your TNC connection.

@echo off
set PORT=COM5
echo Hit Ctl-C to break out of this file
mode %PORT%: 9600,n,8,1
:again
echo Copy file...
copy w180.bin %PORT% >nul
echo Wait...
sleep 6
goto again

The following is a bash shell script to do the same thing.

#!/bin/bash

PORT=/dev/ttyUSB0

stty -F $PORT raw ispeed 9600 ospeed 9600 cs8 -ignpar -cstopb -echo

echo "Hit Ctl-C to break out of this file"

#for ((j=0; j<$1; j++)); do
while [ 1 ]; do
  echo "Send data..."
  cp w180.bin $PORT
  echo "Wait..."
  sleep 6
done

The following is an expect script to do the same thing.

#!/usr/bin/expect
#script to set KISS mode

encoding system iso8859-1

if {[lindex $argv 0] == ""} {
  set port /dev/ttyUSB0
} else {
  set port [lindex $argv 0]
}

set spawned [spawn -open [open $port RDWR]]
set baud 9600
# -parenb means don't use a parity bit
# -cstopb means "not 2 stop bits, but 1"
# cs8 means 8 bits
# -echo means no echo (full duplex?)
stty ispeed $baud ospeed $baud raw -echo cs8 -parenb -cstopb -onlcr < $port

set timeout 2
#flush buffer

after 1000

set len 750 
set wt [expr 1000*$len*8/1200+2000]

for {set j 0} {$j < 10} {incr j} {
  send_tty "Send data\n"
  send "\xc0\x00"
  for {set i 0} {$i < $len} {incr i} {
    send "\x77"
  }
  send "\xc0"
  send_tty "Wait...\n"
  after $wt
  }

exit

Links

kissiso.zip