]> git.donarmstrong.com Git - tmk_firmware.git/blob - keyboard/hhkb_rn42/MEMO.txt
28c5a09d38106e755a2709f39792d266cc677060
[tmk_firmware.git] / keyboard / hhkb_rn42 / MEMO.txt
1 Roving RN-42
2 ============
3 07/16   After fix of voltage dividor on GPIO6, had a trouble that it could not send a char to BT module, though could receive.
4         Found R8 had wrong 1K resistor and changed to 10K, after that it can send to the module again. Not sure how it had sent with the wrong 1K before.
5 07/18   On Linux, had an USB related trouble; keyobard or console didn't work for some reason. Changing PID cured this problem. Very annoying, took very long time before resolved it.
6
7
8
9 TODO
10 ----
11 - LUFA sendchar should be buffered and serial_uart.c buffur size is too large(256).
12 - Factroy reset doesn't work; need to test again. 10K pull-up is too high?
13 - Lipo voltage ADC sensing
14 - Lipo charger configuration: fast charge time:  USB charger spec?
15 - Low voltage alarm: LED indcates voltage of Lipo
16 - CTS/RTS lines are needed? just connect in loop back if no flow control is needed.
17 - CTS is needed for waking up from deep sleep?
18 - Serial API callback  when data are available/received(and when send buffer is available)
19 - Serial API instance  several serial ports can be used
20 - DCDC converter: squeaky inducter with onsemi NCP1402
21 - Lipo charger MCP73831: needs capacitor 4.7uF *2
22 - Keymap layer bug: during space is pressed(mousekey) press Fn(HHKB) then release space before Fn, in result HHKB layer is locked(toggled) unintentionally.
23
24 DONE:
25 - USB connection check - 07.01
26 - BT on/off check: whether RX line is pulled up? - checking RTS 07.01
27 - USB/BT switching  BT is on -> BT, BT is off -> USB - 07.01
28 - Under voltage lock out UVLO for protection of Lipo - Lipo has discharge protection at 3.100V    07.01
29 - Power saving: HHKB scan, BT radio control - 9h with 850mAh, this is enough   07.01
30 - Power selector doesn't work; Q4 MOSFET leaks from Lipo to USB power line. -- use Schottky instead 07/04
31
32
33 Lipo
34 ----
35 Sparkfun Polymer Lithium Ion Battery 850mAh:
36 https://www.sparkfun.com/products/341
37 Lipo Cell spec:
38 https://www.sparkfun.com/datasheets/Batteries/063048%20Li-polymer.pdf
39 Protection spec:
40 http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Prototyping/BatteryProtection.pdf
41                             min     typical max
42 over-charge                 4.255   4.280   4.305
43 over-charge discover?       4.030   4.080   4.130        
44 over-discharge              2.827   2.900   2.973
45 over-discharge discover     3.022   3.100   3.178
46
47 ADC voltage monitor:    voltage divider 10K+10K(0.5)
48     ADC=V*0.5/2.56*1024
49     V       ADC
50     ------------------
51     4.20    0x347(839)
52     3.10    0x26b(619)
53     
54
55
56
57 Configuration
58 -------------
59 Ver 6.15 04/26/2013
60 (c) Roving Networks
61 ***Settings***
62 BTA=0006664B3AE3
63 BTName=tmkBT-3AE3
64 Baudrt(SW4)=115K
65 Mode  =DTR
66 Authen=2
67 Bonded=0
68 Rem=000000000000
69 ***ADVANCED Settings***
70 SrvName= keyboard/mouse
71 SrvClass=0000
72 DevClass=0000
73 InqWindw=0100
74 PagWindw=0100
75 CfgTimer=255
76 StatuStr=NULL
77 HidFlags=3c
78 DTRtimer=8
79 KeySwapr=0
80 ***OTHER Settings***
81 Profile= HID
82 CfgChar= $
83 SniffEna=8010
84 LowPower=0
85 TX Power=0
86 IOPorts= 0
87 IOValues=0
88 Sleeptmr=0
89 DebugMod=0
90 RoleSwch=0
91
92
93
94 Serial connection
95 -----------------
96 Serial line:    115200bps, 8bit, 1-stopbit, non-parity, no flow control
97 SSP:            115200bps, 8bit, 1-stopbit, non-parity, no flow control(via Bluetooth)
98
99 To enter command mode disconnect the module from host and type '$$$'.(you will see 'CMD')
100 To exit type '---'(you will see 'END') and '+' to get local echo.
101
102
103
104 Setting command mode
105 --------------------
106 S-,tmkBT            // Device name
107 SS,keyboard/mouse   // service name
108 SM,4                // Auto Connect DTR mode
109 SW,8010             // Sniff enable 0x10*0.625ms=10ms; 50ms is laggish and not much power save
110 S~,6                // HID profile
111 SH,003C             // HID register
112 SY,0004             // Transmit power
113
114
115
116
117 Other options:
118 SC,0000         // COD: 000005C0    (see HID spec/Bluegiga doc)
119 SD,05C0         //     bit 12-8         7           6           5-0
120                 //         00101        1           1           0
121                 //         peripheral   pointing    keybaord    joystick, gamepad, ...
122 SM,6                // Pairing mode: auto connect
123 SM,4                // Master mode: Connection can be controled with GPIO6
124
125
126
127
128 HID profile
129 -----------
130 S~,6    HID profile
131 S~,0    SPP profile
132 R,1     reboot
133
134
135 Apple iOS
136 ---------
137 Cannot supported without apple iAP authentication chip.
138
139
140 HID flag register
141 -----------------
142 SH,0200
143 GH
144
145 10 0000 0000(0200)  default
146 00 0011 1000(0038)  Combo
147 || |  | |\_\____ number of paired devices to which the module can reconnect
148 || |  | \_______ send out reports over UART (0xFF <len> <data>)
149 || \__\_________ descriptor type
150 |\______________ toggle virtual keyboard on iOS when first connected
151 \_______________ Force HID mode if GPIO11 is high on power-up
152
153     Descriptor type:
154     0000:   keybaord
155     0001:   Game Pad
156     0010:   Mouse
157     0011:   Combo
158     0100:   Joystick
159     1xxx:   reserved
160
161 Out report - Indicator
162 ----------------------
163 0xFE 0x02 0x01 <LED_state>
164
165
166 LED Status
167 ----------
168 Configuring                     10 times per sec
169 Startup/configuration timer     2 times per sec
170 Discoverable/Inquiring/Idle     once per sec
171 Connected                       solid on
172
173
174 Pairing
175 -------
176 First, host initiates pairing process and once it is done, auto connect will work thereafter.
177 SM,3        Master mode
178 SM,4        Auto Connect DTR Mode uses GPIO6 to make and break connection(Mode =DTR)
179                 confirm: auto connect works and control connection with GPIO6
180 SM,5        Auto Connect ANY Mode (Mode =ANY)
181                 each time GPIO is set, make inquiry and connect to the first found device
182 SM,6        automatically reconnect(Mode =Pair)
183                 confirm: auto connect works well but difficult to enter command mode.
184
185
186 Fast data mode
187 --------------
188 The module enters fast data mode after 'remote configuration timer' window is passed from power on.
189 In this mode the module does not accept '$$$' to enter command mode.
190
191 Power Management
192 ----------------
193 Inquiry and Page window     Idle or Active  (3.1.1)
194     Downside: delay in discovery or connection time
195     SI,         // set inquiry scan window(discovery) on/off duty?
196     SJ,         // set page scan window(connection)
197     This reduces averaege power >20mA to 5mA(3mA in Sniff mode)
198
199 Sniff mode                  Transmit
200     Sniff mode is disabled by default and radio is active continuously when connected.(25-30mA)
201     In Sniff mode the radio wakes up intermittently and sleeps in very low power mode.(2mA)
202     SW,<val>    // set interval timer(*0.625ms) 0000-7FFF
203
204 Deep sleep                  Idle            (3.1.2)
205     In this mode the module shuts down completly and only draws about 300uA. To enable this set the most signifant bit(0x8000) of Sniff interaval timer.
206     SW,8320     // deep sleep enable(interval=0x320*0.625=500ms)
207     In normal sleep the firmware is still running in idle mode, and wakes up about 20 times per second to check ports, update LEDs, etc. During deep sleep, the firmware actually stops runnig some tasks and the LEDs only update about once per second.
208     To wake from deep sleep there are three ways: (in worst case wake up takes 5ms)
209         *send a charactor to the UART(first charactor will be lost)
210         *toggle CTS low to high and wait 5ms
211         *wake automatically every slot time(<val>*0.625ms)
212     Once the radio is awake it stay active for exactly 1 second of inactivity and then sleeps again.
213     Downside: latency and data loss
214
215 Disable Output driver       Idle or Active  (3.1.3)
216     S%,1000     // set all GPIO pins(0-11) to inputs.
217
218 Lower Transmit Power        Idle or Active  (3.1.4)
219     SY,<hex>    // transmit power setting(takes effect after a power cycle and reboot)
220     Downside: reducing effective range
221
222
223 Optimizig for Latency
224 ---------------------
225 By default the firmware is optimized for throughput.
226 SQ,16           // set latency bit
227 SQ,0            // unset latency bit
228
229
230 Configuration timer settings
231 ----------------------------
232 Remote configuration is used for the module to be configured with various commands over Bluetooth(SPP profile only?).
233
234 The module has remote configuration timer to allow remote configuration over Bluetooth after power up in Slave mode. In Master modes the remote configuration timer is set to 0(no remote configuration). (In Trigger Master mode the timer is used as an idle timer to break the connection after time expires with no charactors receive.)
235     ST,0        // no remote, no local when connected
236     ST,<1-252>  // local and remote with timeout in seconds from power up
237     ST,253      // local only       without timeout
238     ST,254      // remote only      without timeout
239     ST,255      // local and remote without timeout
240
241
242 Android
243 -------
244 3.7.1.5 Note: To connect with Android phone the modules must wake up 11ms every 2.5seconds.
245
246
247 Commands
248 --------
249 SC,
250 SM,<val>
251 SD,         
252 SP,<string>             Pin code(alpahnumeric)
253 SQ,<mask>               Special configuration(GPIO, discovery mode, low latency, reboot, UART)
254 SR,<hex>                Store remote address
255 SR,Z                    Erase all address
256 SS,<string>             Set service name(1-20)**
257 ST,<val>                Remote configuration timer(Master:0, Slave:0-255, Triger:as idle timer)
258 SU,<val>                UART baud rate
259 SW,<val>                low-power sniff mode** deep sleep and wake up every 625us * <val>
260 SX,<0|1>                bonding enable  only acceps device that matches the stored address
261 SY,<hex>                power setting** 
262 SZ,<val>                non-standard raw baud rate  <val>=baud*0.004096
263 S~,<val>                Profile     0:SPP, 5:APL, 6:HID
264 S-,<string>             Device name     -15 alphanumeric charactors
265 S?,<0|1>                role switch enable
266 S$,<char>               command mode char
267 $|,<hex>                low-power connect mode  deep sleep/active(discoverable and connectable) cycle
268 D                       display basic setting
269 E                       display extended setting
270 GB                      display the device's Bluetooth address
271 GF                      display Bluetooth address of connected device
272 GK                      show connection status
273 GR                      show remote address for reconnecting
274 G&                      show GPIO pin
275 G<char>                 show stored setting
276 +                       toggle local echo on/off
277 &                       show GPIO 3,4,6,7(DIP switch)
278 C                       connect to stored remote address
279 C,<address>             connect last address
280 CFI                     connect and go into fast data mode
281 CFR                     connect and go into fast data mode
282 CT,<address>,<val>      connect to the address and disconnect after val?
283 F,1                     fast data mod:
284 H                       display help
285 I,<time>,<cod>          inquiry scan with <cod>
286 IN
287 IQ                      scan
288 IS                      inquiry scan with 001F00
289 J                       hide pin code
290 K,                      kill    disconnects current connection
291 L                       link quality
292 M                       show modem signlal status
293 O                       display other settings
294 P,<car>                 pass through?
295 Q                       quiet mode  make the module not discoverable
296 Q,0                     discoverable and connectable
297 Q,1                     not discoverable and not connectable
298 Q,2                     not discoverable and connectable
299 Q,?                     display current quiet mode
300 R,1                     reboot
301 T,<0|1>                 pass received data while in command mode
302 U,<baud>,<parity>       change UART setting tentatively
303 V                       display firmware version
304 W                       wake from quiet mode    enable discovery and connection
305 Z                       deep sleep mode(<2mA)
306
307
308
309 help
310 ----
311 *** SET COMMANDS ***
312 SA,<3,0>   - Authentication
313 SC,<hex>   - Service Class
314 SD,<hex>   - Device Class
315 SE,<1-16>  - UUID
316 SF,1       - Factory Defaults
317 SH,<hex>   - HID flags
318 SI,<hex>   - Inquiry Scan Window
319 SJ,<hex>   - Page Scan Window
320 SL,<E,O,N> - Parity
321 SM,<0-5>   - Mode (0=slav,1=mstr,2=trig,3=auto,4=DTR,5=Any)
322 SN,<name>  - Name
323 SO,<text>  - conn/discon Status
324 SP,<text>  - Pin Code
325 SR,<adr>   - Remote Address
326 SS,<text>  - Service Name
327 ST,<num>   - Config Timer
328 SU,<rate>  - Baudrate
329 SW,<hex>   - Sniff Rate
330 SX,<1,0>   - Bonding
331 SY,<hex>   - TX power
332 SZ,<num>   - Raw Baudrate
333 S~,<0-6>   - Profile (0=SPP,1=DCE,2=DTE,3=MDM,4=D&S,6=HID
334 S?,<0-1>   - role switch
335 S$,<char>  - CMD mode char
336 S@,<hex>   - io port dir
337 S&,<hex>   - io port val
338 S%,<hex>   - io boot dir
339 S^,<hex>   - io boot val
340 S*,<hex>   - pio(8-11) set
341 S|,<hex>   - low power timers
342 S+,<num>   - DTR timer
343 S=,<hex>   - Key mapper
344 S:,<num>   - sleep timer
345 *** DISPLAY      ***
346 D     - Basic Settings
347 E     - Extended Settings
348 G<X>  - Stored setting
349 GB    - BT Address
350 GF    - BT Address of Last Connection
351 GK    - Connect Status
352 G&    - I/O Ports
353 V     - Firmare version
354 *** OTHER        ***
355 C,<adr>    - Connect
356 F,1        - Fast Mode
357 I,<time>,<cod> - Device Scan Inquiry
358 J          - Hide Pin Code
359 K,         - Kill (disconnect)
360 L,         - toggle local echo
361 P,<text>   - Pass Thru
362 Q          - Quiet (no discovery)
363 R,1        - Reboot
364 T,<0,1>    - send data in CMD mode
365 U,<rate>,<E,O,N> - Temp Uart Change
366 Z          - low power sleep
367 &          - Read switches