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