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. |
Additional comment from Razvan's post:
BTW, one more thing: although my instructions tell you how to do it for _both_ pins, you can just disable one or the other. For instance, if you have a GPS connected (so you only need to read from the serial port, not write), you could simply disable the TX pin only and use it as GPIO. Same if you just want to control some external equipment over serial (but you don't need it to ever answer back): disable the RX but keep the TX up.
It appears to be smart enough to keep the serial line running even if the pins are no longer connected (so if you write anything to the serial port while the TX line is not connected, that info will get lost).
Very nice...