1 # PL2303, CP2103 and FT232R Userspace GPIO control tools
3 This is a set of small tools for linux userspace that allows you to interact
4 with GPIO lines on PL2303HX, CP2103 and FT232R devices.
5 PL2303: It has only been tested on PL2303HXA, but may work for other revisions.
6 CP2103: It has only been tested on CP2103, but may work for other revisions/versions.
7 FT232R: It has only been tested on FT232R, but may work also for other revisions/versions.
9 Since no common GPIO driver for those exists at the time of writing in
10 the linux kernel - this should serve as a placeholder till upstream guys
14 # Compiling & installing
16 You'll need libusb-1.0-dev, gcc and pkg-config. Just run
22 ##Installing udev rules (Linux only)
24 This package comes with udev rules that will be dropped into your
27 To automagically install and reload rules run
30 sudo make install-rules
33 and replug your pl2303/cp2103/ft232r dongles. You should no longer need root
34 permissions to access gpio in them.
36 ## Do I have to close minicom / rmmod pl2303 or rmmod ftdi_sio to use this tool ?
38 Nope. Just run it in a separate terminal whenever you need it
40 ## Can I chose which of 70 PL2303 devices plugged this will work with?
42 Yep. You can specify --product, --serial and --manuf strings to match
44 These must _precede_ any other options. Example:
47 ./cp2303gpio --product=PowerUART --serial=fireblade --gpio 0 --out 1
54 PL2303HXA/CP2103 userspace GPIO control tool
55 (c) Andrew 'Necromant' Andrianov 2014, License: GPLv3
56 Usage: ./cp2103gpio [action1] [action2] ...
58 --product=blah - Use device with this 'product' string
59 --serial=blah - Use device with this 'serial' string
60 --manuf=blah - Use device with this 'manufacturer' string
61 -g/--gpio n - select GPIO, n=0, 1
62 -i/--in - configure GPIO as input
63 -o/--out v - configure GPIO as output with value v
64 -r/--read v - Read current GPIO value
66 -s/--sleep v - Delay for v ms
69 ./cp2103gpio --gpio=1 --out 1
70 ./cp2103gpio --gpio=0 --out 0 --gpio=1 --in
72 All arguments are executed from left to right, you can add
73 delays using --sleep v option. e.g.
74 ./cp2103gpio --gpio=0 --out 0 --sleep 1000 --gpio=0 --out 1
79 PL2303HXA/CP2103 userspace GPIO control tool
80 (c) Andrew 'Necromant' Andrianov 2014, License: GPLv3
81 Usage: ./pl2303gpio [action1] [action2] ...
83 --product=blah - Use device with this 'product' string
84 --serial=blah - Use device with this 'serial' string
85 --manuf=blah - Use device with this 'manufacturer' string
86 -g/--gpio n - select GPIO, n=0, 1
87 -i/--in - configure GPIO as input
88 -o/--out v - configure GPIO as output with value v
89 -r/--read v - Read current GPIO value
91 -s/--sleep v - Delay for v ms
94 ./pl2303gpio --gpio=1 --out 1
95 ./pl2303gpio --gpio=0 --out 0 --gpio=1 --in
98 pl2302gpio actually do *not* support for gpio>=2.
99 Witout notice gpio=0 is used in this case!
101 All arguments are executed from left to right, you can add
102 delays using --sleep v option. e.g.
103 ./pl2303gpio --gpio=0 --out 0 --sleep 1000 --gpio=0 --out 1
108 FT232R userspace GPIO control tool
109 (c) Peter Henn 2017, License: GPLv3
110 Usage: ./ft232rgpio [action1] [action2] ...
112 --product=blah - Use device with this 'product' string
113 --serial=blah - Use device with this 'serial' string
114 --manuf=blah - Use device with this 'manufacturer' string
115 -g/--gpio n - select GPIO, n=0, 1
116 -i/--in - configure GPIO as input
117 -o/--out v - configure GPIO as output with value v
118 -r/--read v - Read current GPIO value
120 -s/--sleep v - Delay for v ms
123 ./ft232rgpio --gpio=1 --out 1
124 ./ft232rgpio --gpio=0 --out 0 --gpio=1 --in
127 Changing the so called CBUS GPIO lines of the FT232R chip
128 requires prior a correct programming of the embedded EEPROM
129 of this chip. Ft232rgpio is tested only for gpio outputs
130 and altering only one GPIO line!
132 All arguments are executed from left to right, you can add
133 delays using --sleep v option. e.g.
134 ./ft232rgpio --gpio=0 --out 0 --sleep 1000 --gpio=0 --out 1
139 cp2303 code misses magic required for 'input' mode of GPIO lines.
142 The arguments are executed from left to right. Therefore you can use only one
143 call to pl2303gpio/cp2303gpio to execute a sequence of actions. If the gpio line
144 stays the same, you can omit subsequent --gpio arguments.
145 You can use --sleep to add arbitary delays (in milliseconds)
147 Example (sets the gpio3 line to 1, sleeps for one second, sets the gpio3 to 0:
149 ./cp2303gpio --gpio=3 --out=1 --sleep=1000 --out=0
153 The 'extra' directory contains a few scripts I use on my OpenWRT box to manage a few
154 SBC servers. They are installed via install-scripts.
156 serverctl - is a bach script that allows quickly to power on/power off/reboot/access minicom on any of the boxes by just supplying the hostname (which is also wired into cp2303 onboard eeprom as 'serial number').
157 serverd - is a lua daemon that pings servers in round-robin fasion and displays their state on LEDs
160 These tools have been reported to work on Mac OS X. For obvious reasons you
161 don't need udev rules on a mac.
166 GPLv3. I'm too lazy to copy all the text here. Google for it.