1 # PL2303 and CP2103 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 and CP2103 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.
8 Since no common GPIO driver for those exists at the time of writing in
9 the linux kernel - this should serve as a placeholder till upstream guys
13 # Compiling & installing
15 You'll need libusb-1.0-dev, gcc and pkg-config. Just run
21 ##Installing udev rules (Linux only)
23 This package comes with udev rules that will be dropped into your
26 To automagically install and reload rules run
29 sudo make install-rules
32 and replug your pl2303/cp2103 dongles. You should no longer need root
33 permissions to access gpio in them.
35 ## Do I have to close minicom / rmmod pl2303 to use this tool ?
37 Nope. Just run it in a separate terminal whenever you need it
39 ## Can I chose which of 70 PL2303 devices plugged this will work with?
41 Yep. You can specify --product, --serial and --manuf strings to match
43 These must _precede_ any other options. Example:
46 ./cp2303gpio --product=PowerUART --serial=fireblade --gpio 0 --out 1
53 PL2303HXA/CP2103 userspace GPIO control tool
54 (c) Andrew 'Necromant' Andrianov 2014, License: GPLv3
55 Usage: ./cp2103gpio [action1] [action2] ...
57 --product=blah - Use device with this 'product' string
58 --serial=blah - Use device with this 'serial' string
59 --manuf=blah - Use device with this 'manufacturer' string
60 -g/--gpio n - select GPIO, n=0, 1
61 -i/--in - configure GPIO as input
62 -o/--out v - configure GPIO as output with value v
63 -r/--read v - Read current GPIO value
65 -s/--sleep v - Delay for v ms
68 ./cp2103gpio --gpio=1 --out 1
69 ./cp2103gpio --gpio=0 --out 0 --gpio=1 --in
71 All arguments are executed from left to right, you can add
72 delays using --sleep v option. e.g.
73 ./cp2103gpio --gpio=0 --out 0 --sleep 1000 --gpio=0 --out 1
78 PL2303HXA/CP2103 userspace GPIO control tool
79 (c) Andrew 'Necromant' Andrianov 2014, License: GPLv3
80 Usage: ./pl2303gpio [action1] [action2] ...
82 --product=blah - Use device with this 'product' string
83 --serial=blah - Use device with this 'serial' string
84 --manuf=blah - Use device with this 'manufacturer' string
85 -g/--gpio n - select GPIO, n=0, 1
86 -i/--in - configure GPIO as input
87 -o/--out v - configure GPIO as output with value v
88 -r/--read v - Read current GPIO value
90 -s/--sleep v - Delay for v ms
93 ./pl2303gpio --gpio=1 --out 1
94 ./pl2303gpio --gpio=0 --out 0 --gpio=1 --in
96 All arguments are executed from left to right, you can add
97 delays using --sleep v option. e.g.
98 ./pl2303gpio --gpio=0 --out 0 --sleep 1000 --gpio=0 --out 1
102 cp2303 code misses magic required for 'input' mode of GPIO lines.
105 The arguments are executed from left to right. Therefore you can use only one
106 call to pl2303gpio/cp2303gpio to execute a sequence of actions. If the gpio line
107 stays the same, you can omit subsequent --gpio arguments.
108 You can use --sleep to add arbitary delays (in milliseconds)
110 Example (sets the gpio3 line to 1, sleeps for one second, sets the gpio3 to 0:
112 ./cp2303gpio --gpio=3 --out=1 --sleep=1000 --out=0
116 The 'extra' directory contains a few scripts I use on my OpenWRT box to manage a few
117 SBC servers. They are installed via install-scripts.
119 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').
120 serverd - is a lua daemon that pings servers in round-robin fasion and displays their state on LEDs
123 These tools have been reported to work on Mac OS X. For obvious reasons you
124 don't need udev rules on a mac.
129 GPLv3. I'm too lazy to copy all the text here. Google for it.