All model B-V2 (and model A) owners can set-up their svxlink system without the need of an external USB-2-serial converter. All raspi versions offer a built-in serial port, but only the data signals (RXD/TXD) are available on the GPIO header (see http://elinux.org/RPi_Low-level_peripherals). With the arrival of the version 2 boards things improved. A new connector P5 was introduced. It is right next to the extension header P1, but as shipped there are no pins equipped.
Details on the P5 header can be found at http://www.raspberrypi-spy.co.uk/2012/09/raspberry-pi-p5-header/
Of interest to us are the pins 5+6 (GPIO30+GPIO31). The chip on the raspi allows different mappings as can be found at http://elinux.org/RPi_BCM2835_GPIOs . As can be seen there, GPIO30+GPIO31 can be switch to be RTS0/CTS0 in mode “ALT3”.
To use the IO pins we first need to “free” the serial port for our usage. The default configuration of the linux image uses the built in serial port to dump kernel messages and as a way to log into your raspi.
From /boot/cmdline.txt we need to remove the following options:
We also need to stop the system to spin up a terminal on the serial port. For this we put the following statement in /etc/inittab into comment (add # in front of the line):
#T0:23:respawn:/sbin/getty -L ttyAMA0 115200
OK, the serial port is ours, but we still need a tool to switch the GPIO assignment.
# as pi user, cd /home/pi mkdir rpi-tools cd rpi-tools/ # if you have not yet installed git, this must be done upfront # see comments section below on how to do this git clone https://github.com/rewolff/bw_rpi_tools.git cd bw_rpi_tools/gpio # depending on the version or status of the tools you might need to fix the Makefile # see comments section below make sudo make install
We can now check the current pin assignment:
To reassign the pins to the RTS/CTS function we use the following command:
sudo gpio_setfunc 31 ALT3 sudo gpio_setfunc 30 ALT3
To make this restart safe, we put the command into /etc/rc.local:
# enable CTS+RTS on P5 header for onboard serial /usr/local/bin/gpio_setfunc 31 ALT3 /usr/local/bin/gpio_setfunc 30 ALT3
Bingo. We can now use the built-in serial port in the svxlink configuration by referring to the device: /dev/ttyAMA0 . In svxlink.conf we use:
Until the advent of direct raspi GPIO support in svxlink above few lines will be of help.
WARNING: When connecting external circuitry to the raspi GPIO pins, please be reminded that the Raspberry Pi only support 3.3V signal level. So in the best interest of your raspi keep this in mind!