Home‎ > ‎HowTo‎ > ‎

Use serial TX/RX pins as GPIO

The serial RX and TX pins on the Bifferboard (pins 8 and 9 on J1) can be temporarily disconnected from the serial port and used as plain GPIO ports. If you do not need the serial console or serial port, this is an easy way to obtain two GPIO pins without any soldering.

In order to activate this, use Biff's GPIO patch and issue the following commands:

# first export the two pins - if you're connected over serial, this will temporarily disable your serial connection
echo 7 > /sys/class/gpio/export
echo 8 > /sys/class/gpio/export

Now you can use the pins just like any other GPIO pin, like "echo 1 > /sys/class/gpio/gpio7/value", etc.

When you're done and you want to switch back to serial mode (reactivate your serial console or start talking to a serial equipment), just do

# unexport the pins
echo 7 > /sys/class/gpio/unexport
echo 8 > /sys/class/gpio/unexport

That's all there is to it.

Comments