Linux driver for Z8530 based HDLC cards for AX.25

 

0. Quickstart

To compile the utilities, type

make dep ; make

It will make the following programs:

It will install these utilities in /sbin/ and an example configuration file as /etc/z8530drv.conf.ex. Rename this file to /etc/z8530drv.conf and edit it according to chapter 1.2. Please note that since version 3.0 of this driver the driver itself does not come with this package (hence the package name "z8530drv-*.*-utils.tar.gz").

Now configure the Linux kernel to prepare the compilation of the driver. If you are using menuconfig or xconfig select:

Do not forget to select other AX.25 devices you probably need, and do not forget to include the kernel AX.25 / NET/ROM / Rose stuff as well. Please read the AX25-HOWTO for details.

Save your new kernel configuration and either rebuild your kernel now (if you selected "Y" for CONFIG_SCC), or rebuild your modules (if you selected "M").

1. Initialization of the driver

To use the driver, 3 steps must be performed:

  1. if compiled as module: loading the module
  2. Set-up of hardware, MODEM and KISS parameters with sccinit
  3. Attach each channel to the Linux kernel AX.25 with "ifconfig"

Unlike the versions below 2.4 this driver is a real network device driver. If you want to run xNOS instead of our fine kernel AX.25 use a 2.x version (available from above sites) or read the AX.25-HOWTO on how to emulate a KISS TNC on network device drivers.

1.1 Loading the module

(If you're going to compile the driver as a part of the kernel image, skip this chapter and continue with 1.2)

Before you can use a module, you'll have to load it with

insmod scc

please read 'man insmod' that comes with modutils.

You should include the insmod in one of the /etc/rc.d/rc.* files, and don't forget to insert a call of sccinit after that. It will read your /etc/z8530drv.conf.

1.2 /etc/z8530drv.conf

To set up all parameters you must run /sbin/sccinit from one of your rc.*-files. This has to be done BEFORE you can "ifconfig" an interface. Sccinit reads the file /etc/z8530drv.conf and sets the hardware, MODEM and KISS parameters. A sample file is delivered with this package. Change it to your needs.

The file itself consists of two main sections.

1.2.1 Configuration of hardware parameters

The hardware set-up section defines the following parameters for each Z8530:

chip    1
data_a  0x300                   # data port A
ctrl_a  0x304                   # control port A
data_b  0x301                   # data port B
ctrl_b  0x305                   # control port B
irq     5                       # IRQ No. 5
pclock  4915200                 # clock
board   BAYCOM                  # hardware type
escc    no                      # enhanced SCC chip? (8580/85180/85280)
vector  0                       # latch for interrupt vector
special no                      # address of special function register
option  0                       # option to set via sfr

The config options are:

You can specify up to four chips (8 channels). If this is not enough, just change

#define MAXSCC 4

to a higher value.

1.2.1.1 Example for the BayCom USCC
chip    1
data_a  0x300                   # data port A
ctrl_a  0x304                   # control port A
data_b  0x301                   # data port B
ctrl_b  0x305                   # control port B
irq     5                       # IRQ No. 5 (#)
board   BAYCOM                  # hardware type (*)
#
# SCC chip 2
#
chip    2
data_a  0x302
ctrl_a  0x306
data_b  0x303
ctrl_b  0x307
board   BAYCOM
1.2.1.2 An example for a PA0HZP card
chip 1
data_a 0x153
data_b 0x151
ctrl_a 0x152
ctrl_b 0x150
irq 9
pclock 4915200
board PA0HZP
vector 0x168
escc no
#
#
#
chip 2
data_a 0x157
data_b 0x155
ctrl_a 0x156
ctrl_b 0x154
irq 9
pclock 4915200
board PA0HZP
vector 0x168
escc no
1.2.1.3 A DRSI would should probably work with this (actually: two DRSI cards...)
chip 1
data_a 0x303
data_b 0x301
ctrl_a 0x302
ctrl_b 0x300
irq 7
pclock 4915200
board DRSI
escc no
#
#
#
chip 2
data_a 0x313
data_b 0x311
ctrl_a 0x312
ctrl_b 0x310
irq 7
pclock 4915200
board DRSI
escc no

Note that you cannot use the on-board baudrate generator off DRSI cards. Use "mode dpll" for clock source (see below). This is based on information provided by Mike Bilow (and verified by Paul Helay).

1.2.1.4 The utility "gencfg"

If you only know the parameters for the PE1CHL driver for DOS, run gencfg. It will generate the correct port addresses (I hope). Its parameters are exactly the same as the ones you use with the "attach scc" command in net, except that the string "init" must not appear. Example:

gencfg 2 0x150 4 2 0 1 0x168 9 4915200

will print a skeleton z8530drv.conf for the OptoSCC to stdout.

gencfg 2 0x300 2 4 5 -4 0 7 4915200 0x10

does the same for the BayCom USCC card. I my opinion it is much easier to edit scc_config.h...

1.2.2 Channel configuration

The channel definition is divided into three sub sections for each channel:

An example for scc0:

# DEVICE

device scc0     # the device for the following params

# MODEM / BUFFERS

speed 1200              # the default baudrate
clock dpll              # clock source: 
                        #       dpll     = normal halfduplex operation
                        #       external = MODEM provides own Rx/Tx clock
                        #       divider  = use fullduplex divider if
                        #                  installed (1)
mode nrzi               # HDLC encoding mode
                        #       nrzi = 1k2 MODEM, G3RUH 9k6 MODEM
                        #       nrz  = DF9IC 9k6 MODEM
                        #
bufsize 384             # size of buffers. Note that this must include
                        # the AX.25 header, not only the data field!
                        # (optional, defaults to 384)

# KISS (Layer 1)

txdelay 36              # (see chapter 1.4)
persist 64
slot    8
tail    8
fulldup 0
wait    12
min     3
maxkey  7
idle    3
maxdef  120
group   0
txoff   off
softdcd on                   
slip    off

The order within these sections is unimportant. The order of these sections is important. The MODEM parameters are set with the first recognized KISS parameter. Please note that you can initialize the board only once after boot (or insmod). You can change all parameters but "mode" and "clock" later with the Sccparam program or through KISS. Just to avoid security holes...

(1) this divider is usually mounted on the SCC board (PA0HZP) or not present at all (BayCom). It feeds back the output of the DPLL (digital pll) as transmit clock. Using this mode without a divider installed will normally result in keying the transceiver until maxkey expires, of course without sending anything (useful).

2. Attachment of a channel by your AX.25 software

2.1 Kernel AX.25

To set up an AX.25 device you can simply type:

ifconfig scc0 44.128.1.1 hw ax25 dl0tha-7

This will create a network interface with the IP number 44.128.20.107 and the callsign "dl0tha". If you do not have any IP number (yet) you can use any of the 44.128.0.0 network. Note that you do not need axattach. The purpose of axattach (like slattach) is to create a KISS network device linked to a TTY. Please read the documentation of the ax25-utils and the AX25-HOWTO to learn how to set the parameters of the kernel AX.25.

2.2 NOS, NET and TFKISS

Since the TTY driver (aka KISS TNC emulation) is gone you need to emulate the old behaviour. The cost using these programs is that you probably need to compile the kernel AX.25, regardless if you actually use it or not. First set up your /etc/ax25/axports, for example:

9k6 dl0tha-9 9600 255 4 9600 baud port (scc3)
axlink dl0tha-15 38400 255 4 Link to NOS

Now "ifconfig" the scc device:

ifconfig scc3 44.128.1.1 hw ax25 dl0tha-9

You can now axattach a pseudo-TTY:

axattach /dev/ptys0 axlink

and start your NOS and attach /dev/ptys0 there. The problem is that NOS is reachable only via digipeating through the kernel AX.25 (disastrous on a DAMA controlled channel). To solve this problem, configure "rxecho" to echo the incoming frames from "9k6" to "axlink" and outgoing frames from "axlink" to "9k6" and start:

rxecho

Or simply use "kissbridge" coming with this package:

ifconfig scc3 hw ax25 dl0tha-9
kissbridge scc3 /dev/ptys0

There's a similar program called net2kiss coming with the AX.25 utilities which does basically the same (but the source looks better than mine...) and is better documented.

3. Adjustment and display of parameters

3.1 Displaying SCC parameters

Once a SCC channel has been attached, the parameter settings and some statistic information can be shown using the param program:

dl1bke-u:~$ sccstat scc0

Parameters:

speed       : 1200 baud
txdelay     : 36
persist     : 255
slottime    : 0
txtail      : 8
fulldup     : 1
waittime    : 12
mintime     : 3 sec
maxkeyup    : 7 sec
idletime    : 3 sec
maxdefer    : 120 sec
group       : 0x00
txoff       : off
softdcd     : on
SLIP        : off

Status:

HDLC                  Z8530           Interrupts         Buffers
-----------------------------------------------------------------------
Sent       :     273  RxOver :     0  RxInts :   125074  Size    :  384
Received   :    1095  TxUnder:     0  TxInts :     4684  NoSpace :    0
RxErrors   :    1591                  ExInts :    11776
TxErrors   :       0                  SpInts :     1503
Tx State   :    idle

The status info shown is:

An overrun is abnormal. If lots of these occur, the product of baudrate and number of interfaces is too high for the processing power of you computer. NoSpace errors are not likely caused by the driver or the kernel AX.25.

3.2 Setting parameters

The setting of parameters of the emulated KISS TNC is done in the same way in the SCC driver. You can change parameters by using the kissparms program from the ax25-utils package or use the program "sccparam":

sccparam <device> <paramname> <decimal | hexadecimal value>

You can change the following parameters:

4. Problems

4.1 General problems

If you have tx-problems with your BayCom USCC card please check the manufacturer of the 8530. SGS chips have a slightly different timing. Try Zilog... A solution is to write to register 8 instead to the data port, but this won't work with the ESCC chips. SIGH!

A very common problem is that the PTT locks until the maxkeyup timer expires, although interrupts and clock source are correct. In most cases #define SCC_DELAY solves the problems. For more hints read the (pseudo) FAQ and the documentation coming with z8530drv-utils.

I got reports that the driver has problems on some 386-based systems. (i.e. Amstrad) Those systems have a bogus AT bus timing which will lead to delayed answers on interrupts. You can recognize these problems by looking at the output of Sccstat for the suspected port. See if it shows under- and overruns you own such a system.

Delayed processing of received data:

This depends on

Kernel panics: please read to /linux/README and find out if it really occurred within the scc driver.

If you cannot solve a problem, send me

4.2 Thor RLC100

Mysteriously this board seems not to work with the driver. Anyone got it up-and-running?

5. Appendix

The fullduplex mode 3 works as follows:

1. The protocol layer sends a KISS command

[PARAM_RTS] [TX_ON]

to key up the transmitter. Then it sends the data frame(s) to the driver. When all frames are sent, the driver will send the KISS command

[PARAM_HWEVENT] [HWEV_ALL_SENT].

The protocol layer may now key down the transmitter with

[PARAM_RTS] [TX_OFF]

or send more frames. Note that the maxkeyup timer may expire and key down the transceiver before everything is sent.

2. The driver sends

[PARAM_HWEVENT] [HWEV_DCD_ON] or
[PARAM_HWEVENT] [HWEV_DCD_OFF]

if the status of the DCD changes.

3. The protocol layer can send

[PARAM_HWEVENT] 0

the driver will reply with one of the DCD status messages.

Note that KISS command doesn't necessarily mean that the enclosed data is SLIP encoded. In network driver mode the driver does not encode/decode SLIP, but it will still distinguish between a data and a command packet by the leading byte, just like in 'real' KISS mode.

Note that this feature may vanish without a notice.

6. Thanks

Many thanks to everyone who contributed to this project with ideas, error reports and bug fixes. Special thanks to Guido ten Dolle, PE1NNZ. Guido started the whole project in 1993, some of his code may be still in the current release...

 
 
Last modified: 2010-10-10 Copyright 1996-2010 by Jörg Reuter.