TheLinkBox software delivered with the R.Net Raspbian Linux is compiled with special GPIO support.

The GPIO ports can be used as radio port PTT and COS signals to interface with the connected radio and also to radio port PL (CTCSS) detection signal from an external CTCSS decoder.  Furthermore, available GPIO pins can be used to control radio squelch level, steer channels etc.

gpio-numbers-pi21

Raspberry Pi GPIO COS (Squelch detect)

RPI_GPIO_COS_NPN


A simple transistor buffer circuit can be used to interface the Raspberry Pi GPIO pin input to a radio COS (squelch) circuit. The circuit expects that the COS signal provided is active high.

In the example R.Net TheLinkBox port configuration file /etc/thelinkbox/port1-GPIO.conf GPIO pin 18 is configured as COS input pin. Respectively the same pin is initialized as input pin in the Rpi_GPIO_setup.sh -script

GPIO pin 18 is nicknamed as COS1 to be used with the first radio port, GPIO pin 23 is nicknamed as COS2 for the optional second radio port.

TheLinkBox port configuration with Raspberry Pi GPIO COS method

The port-specific COS port is configured in the port configuration file (example /etc/thelinkbox/port1-gpio.conf). The port configuration file is then configured in the TheLinkBox general configuration file /etc/thelinkbox/tlb.conf  to be loaded up during TheLinkBox startup.

Two parameters in the port configuration file effect the COS input port media and port number.

 

RxCosMethod = 9 selects the Raspberry PI GPIO port mode;

; The following variable selects the method thelinkbox will use to determine
; if your receiver is receiving a signal:
; 0 - none
; 1 - Vox
; 2 - Parallel port (IRLP interface)
; 3 - serial port CTS
; 4 - serial port DSR
; 5 - serial port DCD
; 6 - device supporting /dev/input such as USB HID (Linux only)
; 7 - USB device GPIO (use method 6 for the iMic)
; 8 - PCF8754 I2C port expander on iMic
; 9 - Raspberry Pi GPIO /sys/class/gpio/... method

RxCosMethod = 9

GpioSysClassID = 18 defines GPIO port 18 to be the COS input port;

; For Raspberry Pi GPIO method, define the GPIO port for COS input
; For example 18 for Port1 and 23 for Port2
GpioSysClassId_COS = 18

 

To enable correct polarity of the COS signal (active low), a invert parameter is set active;

By default (without the variable ’InvertCOS’ set active, the signals are active high but with Raspberry Pi 3.3V TTL logic, this is difficult to arrange due to high voltage levels of connected peripherals. A buffer circuit is recommended to protect the GPIO ports from overvoltage

; Set this variable to invert the sense of the COS_Bit
; For Raspberry GPIO, inverted sense means Logic '0' is active state
InvertCOS = 1