-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathREADME.gpio
58 lines (50 loc) · 1.88 KB
/
README.gpio
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Documentation for GPIO support:
GPIO support is a quick hack, internally the signals are handled as
"DCD" pins. So instead of a tty, please specify the GPIO line either as
/sys/class/gpio/gpioX/value:-DCD for positive or
/sys/class/gpio/gpioX/value for negative polarity.
The hardware, and the respective Linux driver, have to support interrupts
on the GPIO pins. The GPIO pins have to be exported and configured before
radioclkd2 starts up.
Example session for the pin GPIO0 on a revision Raspberry PI
(Pin3 on the GPIO connector see http://elinux.org/RPi_Low-level_peripherals):
# cd /sys/class/gpio/
# ls -l
total 0
--w------- 1 root root 4096 Jan 1 1970 export
lrwxrwxrwx 1 root root 0 Jan 1 1970 gpiochip0
--w------- 1 root root 4096 Sep 21 17:55 unexport
# echo 0 >export
# ls -l
total 0
--w------- 1 root root 4096 Sep 21 17:56 export
lrwxrwxrwx 1 root root 0 Sep 21 17:56 gpio0
lrwxrwxrwx 1 root root 0 Jan 1 1970 gpiochip0 <<< NEW!
--w------- 1 root root 4096 Sep 21 17:55 unexport
# cd gpio0
# ls -l
total 0
-rw-r--r-- 1 root root 4096 Sep 21 17:56 active_low
-rw-r--r-- 1 root root 4096 Sep 21 17:56 direction
-rw-r--r-- 1 root root 4096 Sep 21 17:56 edge
drwxr-xr-x 2 root root 0 Sep 21 17:56 power
lrwxrwxrwx 1 root root 0 Sep 21 17:56 subsystem
-rw-r--r-- 1 root root 4096 Sep 21 17:56 uevent
-rw-r--r-- 1 root root 4096 Sep 21 17:56 value
# cat edge
none
# echo both >edge
# cat edge
both <<< GOOD!
# cd /root
# radioclkd2 -s gpio -v -d /sys/class/gpio/gpio0/value:-DCD
version 0.06
Added clock unit 0 on line '/sys/class/gpio/gpio0/value:-DCD'
pid 14661 for device /sys/class/gpio/gpio0/value
warning: bad pulse length 0.000000
pulse start: at 1379783026.001037
warning: bad clear length 1379783026.001037
pulse end: length 0.103644 - 0: 1
pulse start: at 1379783027.002885
pulse end: length 0.096009 - 1: 1
(...)