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