xref: /linux/Documentation/input/devices/walkera0701.rst (revision a976c2951d8f376112361830aa7762beff83a205)
1*b08c118cSDmitry Torokhov===========================
2*b08c118cSDmitry TorokhovWalkera WK-0701 transmitter
3*b08c118cSDmitry Torokhov===========================
4*b08c118cSDmitry Torokhov
5*b08c118cSDmitry TorokhovWalkera WK-0701 transmitter is supplied with a ready to fly Walkera
6*b08c118cSDmitry Torokhovhelicopters such as HM36, HM37, HM60. The walkera0701 module enables to use
7*b08c118cSDmitry Torokhovthis transmitter as joystick
8*b08c118cSDmitry Torokhov
9*b08c118cSDmitry TorokhovDevel homepage and download:
10*b08c118cSDmitry Torokhovhttp://zub.fei.tuke.sk/walkera-wk0701/
11*b08c118cSDmitry Torokhov
12*b08c118cSDmitry Torokhovor use cogito:
13*b08c118cSDmitry Torokhovcg-clone http://zub.fei.tuke.sk/GIT/walkera0701-joystick
14*b08c118cSDmitry Torokhov
15*b08c118cSDmitry Torokhov
16*b08c118cSDmitry TorokhovConnecting to PC
17*b08c118cSDmitry Torokhov================
18*b08c118cSDmitry Torokhov
19*b08c118cSDmitry TorokhovAt back side of transmitter S-video connector can be found. Modulation
20*b08c118cSDmitry Torokhovpulses from processor to HF part can be found at pin 2 of this connector,
21*b08c118cSDmitry Torokhovpin 3 is GND. Between pin 3 and CPU 5k6 resistor can be found. To get
22*b08c118cSDmitry Torokhovmodulation pulses to PC, signal pulses must be amplified.
23*b08c118cSDmitry Torokhov
24*b08c118cSDmitry TorokhovCable: (walkera TX to parport)
25*b08c118cSDmitry Torokhov
26*b08c118cSDmitry TorokhovWalkera WK-0701 TX S-VIDEO connector::
27*b08c118cSDmitry Torokhov
28*b08c118cSDmitry Torokhov (back side of TX)
29*b08c118cSDmitry Torokhov     __   __              S-video:                                  canon25
30*b08c118cSDmitry Torokhov    /  |_|  \             pin 2 (signal)              NPN           parport
31*b08c118cSDmitry Torokhov   / O 4 3 O \            pin 3 (GND)        LED        ________________  10 ACK
32*b08c118cSDmitry Torokhov  ( O 2   1 O )                                         | C
33*b08c118cSDmitry Torokhov   \   ___   /      2 ________________________|\|_____|/
34*b08c118cSDmitry Torokhov    | [___] |                                 |/|   B |\
35*b08c118cSDmitry Torokhov     -------        3 __________________________________|________________ 25 GND
36*b08c118cSDmitry Torokhov                                                          E
37*b08c118cSDmitry Torokhov
38*b08c118cSDmitry TorokhovI use green LED and BC109 NPN transistor.
39*b08c118cSDmitry Torokhov
40*b08c118cSDmitry TorokhovSoftware
41*b08c118cSDmitry Torokhov========
42*b08c118cSDmitry Torokhov
43*b08c118cSDmitry TorokhovBuild kernel with walkera0701 module. Module walkera0701 need exclusive
44*b08c118cSDmitry Torokhovaccess to parport, modules like lp must be unloaded before loading
45*b08c118cSDmitry Torokhovwalkera0701 module, check dmesg for error messages. Connect TX to PC by
46*b08c118cSDmitry Torokhovcable and run jstest /dev/input/js0 to see values from TX. If no value can
47*b08c118cSDmitry Torokhovbe changed by TX "joystick", check output from /proc/interrupts. Value for
48*b08c118cSDmitry Torokhov(usually irq7) parport must increase if TX is on.
49*b08c118cSDmitry Torokhov
50*b08c118cSDmitry Torokhov
51*b08c118cSDmitry Torokhov
52*b08c118cSDmitry TorokhovTechnical details
53*b08c118cSDmitry Torokhov=================
54*b08c118cSDmitry Torokhov
55*b08c118cSDmitry TorokhovDriver use interrupt from parport ACK input bit to measure pulse length
56*b08c118cSDmitry Torokhovusing hrtimers.
57*b08c118cSDmitry Torokhov
58*b08c118cSDmitry TorokhovFrame format:
59*b08c118cSDmitry TorokhovBased on walkera WK-0701 PCM Format description by Shaul Eizikovich.
60*b08c118cSDmitry Torokhov(downloaded from http://www.smartpropoplus.com/Docs/Walkera_Wk-0701_PCM.pdf)
61*b08c118cSDmitry Torokhov
62*b08c118cSDmitry TorokhovSignal pulses
63*b08c118cSDmitry Torokhov-------------
64*b08c118cSDmitry Torokhov
65*b08c118cSDmitry Torokhov::
66*b08c118cSDmitry Torokhov
67*b08c118cSDmitry Torokhov                     (ANALOG)
68*b08c118cSDmitry Torokhov      SYNC      BIN   OCT
69*b08c118cSDmitry Torokhov    +---------+      +------+
70*b08c118cSDmitry Torokhov    |         |      |      |
71*b08c118cSDmitry Torokhov  --+         +------+      +---
72*b08c118cSDmitry Torokhov
73*b08c118cSDmitry TorokhovFrame
74*b08c118cSDmitry Torokhov-----
75*b08c118cSDmitry Torokhov
76*b08c118cSDmitry Torokhov::
77*b08c118cSDmitry Torokhov
78*b08c118cSDmitry Torokhov SYNC , BIN1, OCT1, BIN2, OCT2 ... BIN24, OCT24, BIN25, next frame SYNC ..
79*b08c118cSDmitry Torokhov
80*b08c118cSDmitry Torokhovpulse length
81*b08c118cSDmitry Torokhov------------
82*b08c118cSDmitry Torokhov
83*b08c118cSDmitry Torokhov::
84*b08c118cSDmitry Torokhov
85*b08c118cSDmitry Torokhov   Binary values:		Analog octal values:
86*b08c118cSDmitry Torokhov
87*b08c118cSDmitry Torokhov   288 uS Binary 0		318 uS       000
88*b08c118cSDmitry Torokhov   438 uS Binary 1		398 uS       001
89*b08c118cSDmitry Torokhov				478 uS       010
90*b08c118cSDmitry Torokhov				558 uS       011
91*b08c118cSDmitry Torokhov				638 uS       100
92*b08c118cSDmitry Torokhov  1306 uS SYNC			718 uS       101
93*b08c118cSDmitry Torokhov				798 uS       110
94*b08c118cSDmitry Torokhov				878 uS       111
95*b08c118cSDmitry Torokhov
96*b08c118cSDmitry Torokhov24 bin+oct values + 1 bin value = 24*4+1 bits  = 97 bits
97*b08c118cSDmitry Torokhov
98*b08c118cSDmitry Torokhov(Warning, pulses on ACK are inverted by transistor, irq is raised up on sync
99*b08c118cSDmitry Torokhovto bin change or octal value to bin change).
100*b08c118cSDmitry Torokhov
101*b08c118cSDmitry TorokhovBinary data representations
102*b08c118cSDmitry Torokhov---------------------------
103*b08c118cSDmitry Torokhov
104*b08c118cSDmitry TorokhovOne binary and octal value can be grouped to nibble. 24 nibbles + one binary
105*b08c118cSDmitry Torokhovvalues can be sampled between sync pulses.
106*b08c118cSDmitry Torokhov
107*b08c118cSDmitry TorokhovValues for first four channels (analog joystick values) can be found in
108*b08c118cSDmitry Torokhovfirst 10 nibbles. Analog value is represented by one sign bit and 9 bit
109*b08c118cSDmitry Torokhovabsolute binary value. (10 bits per channel). Next nibble is checksum for
110*b08c118cSDmitry Torokhovfirst ten nibbles.
111*b08c118cSDmitry Torokhov
112*b08c118cSDmitry TorokhovNext nibbles 12 .. 21 represents four channels (not all channels can be
113*b08c118cSDmitry Torokhovdirectly controlled from TX). Binary representations are the same as in first
114*b08c118cSDmitry Torokhovfour channels. In nibbles 22 and 23 is a special magic number. Nibble 24 is
115*b08c118cSDmitry Torokhovchecksum for nibbles 12..23.
116*b08c118cSDmitry Torokhov
117*b08c118cSDmitry TorokhovAfter last octal value for nibble 24 and next sync pulse one additional
118*b08c118cSDmitry Torokhovbinary value can be sampled. This bit and magic number is not used in
119*b08c118cSDmitry Torokhovsoftware driver. Some details about this magic numbers can be found in
120*b08c118cSDmitry TorokhovWalkera_Wk-0701_PCM.pdf.
121*b08c118cSDmitry Torokhov
122*b08c118cSDmitry TorokhovChecksum calculation
123*b08c118cSDmitry Torokhov--------------------
124*b08c118cSDmitry Torokhov
125*b08c118cSDmitry TorokhovSummary of octal values in nibbles must be same as octal value in checksum
126*b08c118cSDmitry Torokhovnibble (only first 3 bits are used). Binary value for checksum nibble is
127*b08c118cSDmitry Torokhovcalculated by sum of binary values in checked nibbles + sum of octal values
128*b08c118cSDmitry Torokhovin checked nibbles divided by 8. Only bit 0 of this sum is used.
129