18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci===============================
48c2ecf20Sopenharmony_ciLinux Drivers for Baycom Modems
58c2ecf20Sopenharmony_ci===============================
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ciThomas M. Sailer, HB9JNX/AE4WA, <sailer@ife.ee.ethz.ch>
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ciThe drivers for the baycom modems have been split into
108c2ecf20Sopenharmony_ciseparate drivers as they did not share any code, and the driver
118c2ecf20Sopenharmony_ciand device names have changed.
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciThis document describes the Linux Kernel Drivers for simple Baycom style
148c2ecf20Sopenharmony_ciamateur radio modems.
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ciThe following drivers are available:
178c2ecf20Sopenharmony_ci====================================
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_cibaycom_ser_fdx:
208c2ecf20Sopenharmony_ci  This driver supports the SER12 modems either full or half duplex.
218c2ecf20Sopenharmony_ci  Its baud rate may be changed via the ``baud`` module parameter,
228c2ecf20Sopenharmony_ci  therefore it supports just about every bit bang modem on a
238c2ecf20Sopenharmony_ci  serial port. Its devices are called bcsf0 through bcsf3.
248c2ecf20Sopenharmony_ci  This is the recommended driver for SER12 type modems,
258c2ecf20Sopenharmony_ci  however if you have a broken UART clone that does not have working
268c2ecf20Sopenharmony_ci  delta status bits, you may try baycom_ser_hdx.
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_cibaycom_ser_hdx:
298c2ecf20Sopenharmony_ci  This is an alternative driver for SER12 type modems.
308c2ecf20Sopenharmony_ci  It only supports half duplex, and only 1200 baud. Its devices
318c2ecf20Sopenharmony_ci  are called bcsh0 through bcsh3. Use this driver only if baycom_ser_fdx
328c2ecf20Sopenharmony_ci  does not work with your UART.
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_cibaycom_par:
358c2ecf20Sopenharmony_ci  This driver supports the par96 and picpar modems.
368c2ecf20Sopenharmony_ci  Its devices are called bcp0 through bcp3.
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_cibaycom_epp:
398c2ecf20Sopenharmony_ci  This driver supports the EPP modem.
408c2ecf20Sopenharmony_ci  Its devices are called bce0 through bce3.
418c2ecf20Sopenharmony_ci  This driver is work-in-progress.
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ciThe following modems are supported:
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci======= ========================================================================
468c2ecf20Sopenharmony_ciser12   This is a very simple 1200 baud AFSK modem. The modem consists only
478c2ecf20Sopenharmony_ci	of a modulator/demodulator chip, usually a TI TCM3105. The computer
488c2ecf20Sopenharmony_ci	is responsible for regenerating the receiver bit clock, as well as
498c2ecf20Sopenharmony_ci	for handling the HDLC protocol. The modem connects to a serial port,
508c2ecf20Sopenharmony_ci	hence the name. Since the serial port is not used as an async serial
518c2ecf20Sopenharmony_ci	port, the kernel driver for serial ports cannot be used, and this
528c2ecf20Sopenharmony_ci	driver only supports standard serial hardware (8250, 16450, 16550)
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_cipar96   This is a modem for 9600 baud FSK compatible to the G3RUH standard.
558c2ecf20Sopenharmony_ci	The modem does all the filtering and regenerates the receiver clock.
568c2ecf20Sopenharmony_ci	Data is transferred from and to the PC via a shift register.
578c2ecf20Sopenharmony_ci	The shift register is filled with 16 bits and an interrupt is signalled.
588c2ecf20Sopenharmony_ci	The PC then empties the shift register in a burst. This modem connects
598c2ecf20Sopenharmony_ci	to the parallel port, hence the name. The modem leaves the
608c2ecf20Sopenharmony_ci	implementation of the HDLC protocol and the scrambler polynomial to
618c2ecf20Sopenharmony_ci	the PC.
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_cipicpar  This is a redesign of the par96 modem by Henning Rech, DF9IC. The modem
648c2ecf20Sopenharmony_ci	is protocol compatible to par96, but uses only three low power ICs
658c2ecf20Sopenharmony_ci	and can therefore be fed from the parallel port and does not require
668c2ecf20Sopenharmony_ci	an additional power supply. Furthermore, it incorporates a carrier
678c2ecf20Sopenharmony_ci	detect circuitry.
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ciEPP     This is a high-speed modem adaptor that connects to an enhanced parallel
708c2ecf20Sopenharmony_ci	port.
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci	Its target audience is users working over a high speed hub (76.8kbit/s).
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_cieppfpga This is a redesign of the EPP adaptor.
758c2ecf20Sopenharmony_ci======= ========================================================================
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ciAll of the above modems only support half duplex communications. However,
788c2ecf20Sopenharmony_cithe driver supports the KISS (see below) fullduplex command. It then simply
798c2ecf20Sopenharmony_cistarts to send as soon as there's a packet to transmit and does not care
808c2ecf20Sopenharmony_ciabout DCD, i.e. it starts to send even if there's someone else on the channel.
818c2ecf20Sopenharmony_ciThis command is required by some implementations of the DAMA channel
828c2ecf20Sopenharmony_ciaccess protocol.
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ciThe Interface of the drivers
868c2ecf20Sopenharmony_ci============================
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ciUnlike previous drivers, these drivers are no longer character devices,
898c2ecf20Sopenharmony_cibut they are now true kernel network interfaces. Installation is therefore
908c2ecf20Sopenharmony_cisimple. Once installed, four interfaces named bc{sf,sh,p,e}[0-3] are available.
918c2ecf20Sopenharmony_cisethdlc from the ax25 utilities may be used to set driver states etc.
928c2ecf20Sopenharmony_ciUsers of userland AX.25 stacks may use the net2kiss utility (also available
938c2ecf20Sopenharmony_ciin the ax25 utilities package) to convert packets of a network interface
948c2ecf20Sopenharmony_cito a KISS stream on a pseudo tty. There's also a patch available from
958c2ecf20Sopenharmony_cime for WAMPES which allows attaching a kernel network interface directly.
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ciConfiguring the driver
998c2ecf20Sopenharmony_ci======================
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ciEvery time a driver is inserted into the kernel, it has to know which
1028c2ecf20Sopenharmony_cimodems it should access at which ports. This can be done with the setbaycom
1038c2ecf20Sopenharmony_ciutility. If you are only using one modem, you can also configure the
1048c2ecf20Sopenharmony_cidriver from the insmod command line (or by means of an option line in
1058c2ecf20Sopenharmony_ci``/etc/modprobe.d/*.conf``).
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ciExamples::
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci  modprobe baycom_ser_fdx mode="ser12*" iobase=0x3f8 irq=4
1108c2ecf20Sopenharmony_ci  sethdlc -i bcsf0 -p mode "ser12*" io 0x3f8 irq 4
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ciBoth lines configure the first port to drive a ser12 modem at the first
1138c2ecf20Sopenharmony_ciserial port (COM1 under DOS). The * in the mode parameter instructs the driver
1148c2ecf20Sopenharmony_cito use the software DCD algorithm (see below)::
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ci  insmod baycom_par mode="picpar" iobase=0x378
1178c2ecf20Sopenharmony_ci  sethdlc -i bcp0 -p mode "picpar" io 0x378
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ciBoth lines configure the first port to drive a picpar modem at the
1208c2ecf20Sopenharmony_cifirst parallel port (LPT1 under DOS). (Note: picpar implies
1218c2ecf20Sopenharmony_cihardware DCD, par96 implies software DCD).
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ciThe channel access parameters can be set with sethdlc -a or kissparms.
1248c2ecf20Sopenharmony_ciNote that both utilities interpret the values slightly differently.
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ciHardware DCD versus Software DCD
1288c2ecf20Sopenharmony_ci================================
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ciTo avoid collisions on the air, the driver must know when the channel is
1318c2ecf20Sopenharmony_cibusy. This is the task of the DCD circuitry/software. The driver may either
1328c2ecf20Sopenharmony_ciutilise a software DCD algorithm (options=1) or use a DCD signal from
1338c2ecf20Sopenharmony_cithe hardware (options=0).
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_ci======= =================================================================
1368c2ecf20Sopenharmony_ciser12   if software DCD is utilised, the radio's squelch should always be
1378c2ecf20Sopenharmony_ci	open. It is highly recommended to use the software DCD algorithm,
1388c2ecf20Sopenharmony_ci	as it is much faster than most hardware squelch circuitry. The
1398c2ecf20Sopenharmony_ci	disadvantage is a slightly higher load on the system.
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_cipar96   the software DCD algorithm for this type of modem is rather poor.
1428c2ecf20Sopenharmony_ci	The modem simply does not provide enough information to implement
1438c2ecf20Sopenharmony_ci	a reasonable DCD algorithm in software. Therefore, if your radio
1448c2ecf20Sopenharmony_ci	feeds the DCD input of the PAR96 modem, the use of the hardware
1458c2ecf20Sopenharmony_ci	DCD circuitry is recommended.
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_cipicpar  the picpar modem features a builtin DCD hardware, which is highly
1488c2ecf20Sopenharmony_ci	recommended.
1498c2ecf20Sopenharmony_ci======= =================================================================
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_ciCompatibility with the rest of the Linux kernel
1548c2ecf20Sopenharmony_ci===============================================
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_ciThe serial driver and the baycom serial drivers compete
1578c2ecf20Sopenharmony_cifor the same hardware resources. Of course only one driver can access a given
1588c2ecf20Sopenharmony_ciinterface at a time. The serial driver grabs all interfaces it can find at
1598c2ecf20Sopenharmony_cistartup time. Therefore the baycom drivers subsequently won't be able to
1608c2ecf20Sopenharmony_ciaccess a serial port. You might therefore find it necessary to release
1618c2ecf20Sopenharmony_cia port owned by the serial driver with 'setserial /dev/ttyS# uart none', where
1628c2ecf20Sopenharmony_ci# is the number of the interface. The baycom drivers do not reserve any
1638c2ecf20Sopenharmony_ciports at startup, unless one is specified on the 'insmod' command line. Another
1648c2ecf20Sopenharmony_cimethod to solve the problem is to compile all drivers as modules and
1658c2ecf20Sopenharmony_cileave it to kmod to load the correct driver depending on the application.
1668c2ecf20Sopenharmony_ci
1678c2ecf20Sopenharmony_ciThe parallel port drivers (baycom_par, baycom_epp) now use the parport subsystem
1688c2ecf20Sopenharmony_cito arbitrate the ports between different client drivers.
1698c2ecf20Sopenharmony_ci
1708c2ecf20Sopenharmony_civy 73s de
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ciTom Sailer, sailer@ife.ee.ethz.ch
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_cihb9jnx @ hb9w.ampr.org
175