Merge branches 'x86-fixes-for-linus', 'sched-fixes-for-linus', 'timers-fixes-for...
[pandora-kernel.git] / Documentation / input / walkera0701.txt
1
2 Walkera WK-0701 transmitter is supplied with a ready to fly Walkera
3 helicopters such as HM36, HM37, HM60. The walkera0701 module enables to use
4 this transmitter as joystick
5
6 Devel homepage and download:
7 http://zub.fei.tuke.sk/walkera-wk0701/
8
9 or use cogito:
10 cg-clone http://zub.fei.tuke.sk/GIT/walkera0701-joystick
11
12
13 Connecting to PC:
14
15 At back side of transmitter S-video connector can be found. Modulation
16 pulses from processor to HF part can be found at pin 2 of this connector,
17 pin 3 is GND. Between pin 3 and CPU 5k6 resistor can be found. To get
18 modulation pulses to PC, signal pulses must be amplified.
19
20 Cable: (walkera TX to parport)
21
22 Walkera WK-0701 TX S-VIDEO connector:
23  (back side of TX)
24      __   __              S-video:                                  canon25
25     /  |_|  \             pin 2 (signal)              NPN           parport
26    / O 4 3 O \            pin 3 (GND)        LED        ________________  10 ACK
27   ( O 2   1 O )                                         | C
28    \   ___   /      2 ________________________|\|_____|/
29     | [___] |                                 |/|   B |\
30      -------        3 __________________________________|________________ 25 GND
31                                                           E
32
33
34 I use green LED and BC109 NPN transistor.
35
36 Software:
37
38 Build kernel with walkera0701 module. Module walkera0701 need exclusive
39 access to parport, modules like lp must be unloaded before loading
40 walkera0701 module, check dmesg for error messages. Connect TX to PC by
41 cable and run jstest /dev/input/js0 to see values from TX. If no value can
42 be changed by TX "joystick", check output from /proc/interrupts. Value for
43 (usually irq7) parport must increase if TX is on.
44
45
46
47 Technical details:
48
49 Driver use interrupt from parport ACK input bit to measure pulse length
50 using hrtimers.
51
52 Frame format:
53 Based on walkera WK-0701 PCM Format description by Shaul Eizikovich.
54 (downloaded from http://www.smartpropoplus.com/Docs/Walkera_Wk-0701_PCM.pdf)
55
56 Signal pulses:
57                    (ANALOG)
58     SYNC      BIN   OCT
59   +---------+      +------+
60   |         |      |      |
61 --+         +------+      +---
62
63 Frame:
64  SYNC , BIN1, OCT1, BIN2, OCT2 ... BIN24, OCT24, BIN25, next frame SYNC ..
65
66 pulse length:
67    Binary values:               Analog octal values:
68
69    288 uS Binary 0              318 uS       000
70    438 uS Binary 1              398 uS       001
71                                 478 uS       010
72                                 558 uS       011
73                                 638 uS       100
74   1306 uS SYNC                  718 uS       101
75                                 798 uS       110
76                                 878 uS       111
77
78 24 bin+oct values + 1 bin value = 24*4+1 bits  = 97 bits
79
80 (Warning, pulses on ACK are inverted by transistor, irq is raised up on sync
81 to bin change or octal value to bin change).
82
83 Binary data representations:
84
85 One binary and octal value can be grouped to nibble. 24 nibbles + one binary
86 values can be sampled between sync pulses.
87
88 Values for first four channels (analog joystick values) can be found in
89 first 10 nibbles. Analog value is represented by one sign bit and 9 bit
90 absolute binary value. (10 bits per channel). Next nibble is checksum for
91 first ten nibbles.
92
93 Next nibbles 12 .. 21 represents four channels (not all channels can be
94 directly controlled from TX). Binary representations ar the same as in first
95 four channels. In nibbles 22 and 23 is a special magic number. Nibble 24 is
96 checksum for nibbles 12..23.
97
98 After last octal value for nibble 24 and next sync pulse one additional
99 binary value can be sampled. This bit and magic number is not used in
100 software driver. Some details about this magic numbers can be found in
101 Walkera_Wk-0701_PCM.pdf.
102
103 Checksum calculation:
104
105 Summary of octal values in nibbles must be same as octal value in checksum
106 nibble (only first 3 bits are used). Binary value for checksum nibble is
107 calculated by sum of binary values in checked nibbles + sum of octal values
108 in checked nibbles divided by 8. Only bit 0 of this sum is used.
109