xref: /OK3568_Linux_fs/kernel/Documentation/networking/device_drivers/hamradio/baycom.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun
3*4882a593Smuzhiyun===============================
4*4882a593SmuzhiyunLinux Drivers for Baycom Modems
5*4882a593Smuzhiyun===============================
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunThomas M. Sailer, HB9JNX/AE4WA, <sailer@ife.ee.ethz.ch>
8*4882a593Smuzhiyun
9*4882a593SmuzhiyunThe drivers for the baycom modems have been split into
10*4882a593Smuzhiyunseparate drivers as they did not share any code, and the driver
11*4882a593Smuzhiyunand device names have changed.
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunThis document describes the Linux Kernel Drivers for simple Baycom style
14*4882a593Smuzhiyunamateur radio modems.
15*4882a593Smuzhiyun
16*4882a593SmuzhiyunThe following drivers are available:
17*4882a593Smuzhiyun====================================
18*4882a593Smuzhiyun
19*4882a593Smuzhiyunbaycom_ser_fdx:
20*4882a593Smuzhiyun  This driver supports the SER12 modems either full or half duplex.
21*4882a593Smuzhiyun  Its baud rate may be changed via the ``baud`` module parameter,
22*4882a593Smuzhiyun  therefore it supports just about every bit bang modem on a
23*4882a593Smuzhiyun  serial port. Its devices are called bcsf0 through bcsf3.
24*4882a593Smuzhiyun  This is the recommended driver for SER12 type modems,
25*4882a593Smuzhiyun  however if you have a broken UART clone that does not have working
26*4882a593Smuzhiyun  delta status bits, you may try baycom_ser_hdx.
27*4882a593Smuzhiyun
28*4882a593Smuzhiyunbaycom_ser_hdx:
29*4882a593Smuzhiyun  This is an alternative driver for SER12 type modems.
30*4882a593Smuzhiyun  It only supports half duplex, and only 1200 baud. Its devices
31*4882a593Smuzhiyun  are called bcsh0 through bcsh3. Use this driver only if baycom_ser_fdx
32*4882a593Smuzhiyun  does not work with your UART.
33*4882a593Smuzhiyun
34*4882a593Smuzhiyunbaycom_par:
35*4882a593Smuzhiyun  This driver supports the par96 and picpar modems.
36*4882a593Smuzhiyun  Its devices are called bcp0 through bcp3.
37*4882a593Smuzhiyun
38*4882a593Smuzhiyunbaycom_epp:
39*4882a593Smuzhiyun  This driver supports the EPP modem.
40*4882a593Smuzhiyun  Its devices are called bce0 through bce3.
41*4882a593Smuzhiyun  This driver is work-in-progress.
42*4882a593Smuzhiyun
43*4882a593SmuzhiyunThe following modems are supported:
44*4882a593Smuzhiyun
45*4882a593Smuzhiyun======= ========================================================================
46*4882a593Smuzhiyunser12   This is a very simple 1200 baud AFSK modem. The modem consists only
47*4882a593Smuzhiyun	of a modulator/demodulator chip, usually a TI TCM3105. The computer
48*4882a593Smuzhiyun	is responsible for regenerating the receiver bit clock, as well as
49*4882a593Smuzhiyun	for handling the HDLC protocol. The modem connects to a serial port,
50*4882a593Smuzhiyun	hence the name. Since the serial port is not used as an async serial
51*4882a593Smuzhiyun	port, the kernel driver for serial ports cannot be used, and this
52*4882a593Smuzhiyun	driver only supports standard serial hardware (8250, 16450, 16550)
53*4882a593Smuzhiyun
54*4882a593Smuzhiyunpar96   This is a modem for 9600 baud FSK compatible to the G3RUH standard.
55*4882a593Smuzhiyun	The modem does all the filtering and regenerates the receiver clock.
56*4882a593Smuzhiyun	Data is transferred from and to the PC via a shift register.
57*4882a593Smuzhiyun	The shift register is filled with 16 bits and an interrupt is signalled.
58*4882a593Smuzhiyun	The PC then empties the shift register in a burst. This modem connects
59*4882a593Smuzhiyun	to the parallel port, hence the name. The modem leaves the
60*4882a593Smuzhiyun	implementation of the HDLC protocol and the scrambler polynomial to
61*4882a593Smuzhiyun	the PC.
62*4882a593Smuzhiyun
63*4882a593Smuzhiyunpicpar  This is a redesign of the par96 modem by Henning Rech, DF9IC. The modem
64*4882a593Smuzhiyun	is protocol compatible to par96, but uses only three low power ICs
65*4882a593Smuzhiyun	and can therefore be fed from the parallel port and does not require
66*4882a593Smuzhiyun	an additional power supply. Furthermore, it incorporates a carrier
67*4882a593Smuzhiyun	detect circuitry.
68*4882a593Smuzhiyun
69*4882a593SmuzhiyunEPP     This is a high-speed modem adaptor that connects to an enhanced parallel
70*4882a593Smuzhiyun	port.
71*4882a593Smuzhiyun
72*4882a593Smuzhiyun	Its target audience is users working over a high speed hub (76.8kbit/s).
73*4882a593Smuzhiyun
74*4882a593Smuzhiyuneppfpga This is a redesign of the EPP adaptor.
75*4882a593Smuzhiyun======= ========================================================================
76*4882a593Smuzhiyun
77*4882a593SmuzhiyunAll of the above modems only support half duplex communications. However,
78*4882a593Smuzhiyunthe driver supports the KISS (see below) fullduplex command. It then simply
79*4882a593Smuzhiyunstarts to send as soon as there's a packet to transmit and does not care
80*4882a593Smuzhiyunabout DCD, i.e. it starts to send even if there's someone else on the channel.
81*4882a593SmuzhiyunThis command is required by some implementations of the DAMA channel
82*4882a593Smuzhiyunaccess protocol.
83*4882a593Smuzhiyun
84*4882a593Smuzhiyun
85*4882a593SmuzhiyunThe Interface of the drivers
86*4882a593Smuzhiyun============================
87*4882a593Smuzhiyun
88*4882a593SmuzhiyunUnlike previous drivers, these drivers are no longer character devices,
89*4882a593Smuzhiyunbut they are now true kernel network interfaces. Installation is therefore
90*4882a593Smuzhiyunsimple. Once installed, four interfaces named bc{sf,sh,p,e}[0-3] are available.
91*4882a593Smuzhiyunsethdlc from the ax25 utilities may be used to set driver states etc.
92*4882a593SmuzhiyunUsers of userland AX.25 stacks may use the net2kiss utility (also available
93*4882a593Smuzhiyunin the ax25 utilities package) to convert packets of a network interface
94*4882a593Smuzhiyunto a KISS stream on a pseudo tty. There's also a patch available from
95*4882a593Smuzhiyunme for WAMPES which allows attaching a kernel network interface directly.
96*4882a593Smuzhiyun
97*4882a593Smuzhiyun
98*4882a593SmuzhiyunConfiguring the driver
99*4882a593Smuzhiyun======================
100*4882a593Smuzhiyun
101*4882a593SmuzhiyunEvery time a driver is inserted into the kernel, it has to know which
102*4882a593Smuzhiyunmodems it should access at which ports. This can be done with the setbaycom
103*4882a593Smuzhiyunutility. If you are only using one modem, you can also configure the
104*4882a593Smuzhiyundriver from the insmod command line (or by means of an option line in
105*4882a593Smuzhiyun``/etc/modprobe.d/*.conf``).
106*4882a593Smuzhiyun
107*4882a593SmuzhiyunExamples::
108*4882a593Smuzhiyun
109*4882a593Smuzhiyun  modprobe baycom_ser_fdx mode="ser12*" iobase=0x3f8 irq=4
110*4882a593Smuzhiyun  sethdlc -i bcsf0 -p mode "ser12*" io 0x3f8 irq 4
111*4882a593Smuzhiyun
112*4882a593SmuzhiyunBoth lines configure the first port to drive a ser12 modem at the first
113*4882a593Smuzhiyunserial port (COM1 under DOS). The * in the mode parameter instructs the driver
114*4882a593Smuzhiyunto use the software DCD algorithm (see below)::
115*4882a593Smuzhiyun
116*4882a593Smuzhiyun  insmod baycom_par mode="picpar" iobase=0x378
117*4882a593Smuzhiyun  sethdlc -i bcp0 -p mode "picpar" io 0x378
118*4882a593Smuzhiyun
119*4882a593SmuzhiyunBoth lines configure the first port to drive a picpar modem at the
120*4882a593Smuzhiyunfirst parallel port (LPT1 under DOS). (Note: picpar implies
121*4882a593Smuzhiyunhardware DCD, par96 implies software DCD).
122*4882a593Smuzhiyun
123*4882a593SmuzhiyunThe channel access parameters can be set with sethdlc -a or kissparms.
124*4882a593SmuzhiyunNote that both utilities interpret the values slightly differently.
125*4882a593Smuzhiyun
126*4882a593Smuzhiyun
127*4882a593SmuzhiyunHardware DCD versus Software DCD
128*4882a593Smuzhiyun================================
129*4882a593Smuzhiyun
130*4882a593SmuzhiyunTo avoid collisions on the air, the driver must know when the channel is
131*4882a593Smuzhiyunbusy. This is the task of the DCD circuitry/software. The driver may either
132*4882a593Smuzhiyunutilise a software DCD algorithm (options=1) or use a DCD signal from
133*4882a593Smuzhiyunthe hardware (options=0).
134*4882a593Smuzhiyun
135*4882a593Smuzhiyun======= =================================================================
136*4882a593Smuzhiyunser12   if software DCD is utilised, the radio's squelch should always be
137*4882a593Smuzhiyun	open. It is highly recommended to use the software DCD algorithm,
138*4882a593Smuzhiyun	as it is much faster than most hardware squelch circuitry. The
139*4882a593Smuzhiyun	disadvantage is a slightly higher load on the system.
140*4882a593Smuzhiyun
141*4882a593Smuzhiyunpar96   the software DCD algorithm for this type of modem is rather poor.
142*4882a593Smuzhiyun	The modem simply does not provide enough information to implement
143*4882a593Smuzhiyun	a reasonable DCD algorithm in software. Therefore, if your radio
144*4882a593Smuzhiyun	feeds the DCD input of the PAR96 modem, the use of the hardware
145*4882a593Smuzhiyun	DCD circuitry is recommended.
146*4882a593Smuzhiyun
147*4882a593Smuzhiyunpicpar  the picpar modem features a builtin DCD hardware, which is highly
148*4882a593Smuzhiyun	recommended.
149*4882a593Smuzhiyun======= =================================================================
150*4882a593Smuzhiyun
151*4882a593Smuzhiyun
152*4882a593Smuzhiyun
153*4882a593SmuzhiyunCompatibility with the rest of the Linux kernel
154*4882a593Smuzhiyun===============================================
155*4882a593Smuzhiyun
156*4882a593SmuzhiyunThe serial driver and the baycom serial drivers compete
157*4882a593Smuzhiyunfor the same hardware resources. Of course only one driver can access a given
158*4882a593Smuzhiyuninterface at a time. The serial driver grabs all interfaces it can find at
159*4882a593Smuzhiyunstartup time. Therefore the baycom drivers subsequently won't be able to
160*4882a593Smuzhiyunaccess a serial port. You might therefore find it necessary to release
161*4882a593Smuzhiyuna port owned by the serial driver with 'setserial /dev/ttyS# uart none', where
162*4882a593Smuzhiyun# is the number of the interface. The baycom drivers do not reserve any
163*4882a593Smuzhiyunports at startup, unless one is specified on the 'insmod' command line. Another
164*4882a593Smuzhiyunmethod to solve the problem is to compile all drivers as modules and
165*4882a593Smuzhiyunleave it to kmod to load the correct driver depending on the application.
166*4882a593Smuzhiyun
167*4882a593SmuzhiyunThe parallel port drivers (baycom_par, baycom_epp) now use the parport subsystem
168*4882a593Smuzhiyunto arbitrate the ports between different client drivers.
169*4882a593Smuzhiyun
170*4882a593Smuzhiyunvy 73s de
171*4882a593Smuzhiyun
172*4882a593SmuzhiyunTom Sailer, sailer@ife.ee.ethz.ch
173*4882a593Smuzhiyun
174*4882a593Smuzhiyunhb9jnx @ hb9w.ampr.org
175