summaryrefslogtreecommitdiffstats
path: root/protocol/iwrap/iWRAP4.txt
blob: 2a062d9d98d272f9c6925219c1f6fa9baf8dea0d (plain)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
Bulegiga WT12
=============
WT12 is a bluetooth module from Bluegiga. http://www.bluegiga.com/

iWRAP
    higher layer interface for bluetooth firmware
    communicate with UART

iWRAP HID
default setting
    115200  8bit/n/1/n


TODO
----
KiCAD circuit/PCB design
power saving
    AVR sleep(15ms by watch dog timer)
    WT12 sleep
    measuring current consumption
    measuring battery life of normal usage/idle/intensive usage
software reset/bootloarder
LED indicator(chaging/paring/connecting)
license confirmation of suart.c
consumer page is not working
authenticate method/SSP
SPP keyboard support
SPP debug console support
mouse wheel feature request to Bluegiga


Problems
--------
power consumption
no consumer page support(bug?)
no mouse wheel support
no paring management
no interactive auth method


UART hardware flow control
--------------------------
(iWRAP4 User Guide 9.5)
Hardware flow control is enabled by default and it should not be disabled unless mandatory, because without the hardware flow control the data transmission may not be reliable.
If the hardware flow control is enabled from PS-keys, but no flow control is used, the following steps should be implemented in the hardware design:
- CTS pin must be grounded
- RTS pin must be left floating


Power Saving
------------
power consume
    without opimization: 4hr to shutdown(310mAh)
    2011/08/25: 9hr(310mAh) SNIFF MASTER sleep/WDTO_120MS

measure current consumption
    HHKB keyswitch matrix board
        idle
        scanning
    Bluegiga WT12 module
        SLEEP command
        deep sleep on/off in config bits

HHKB keyswich
    how to power off
        I/O pin configuration when sleeping
        FET switch for 5V regulator

Bluetooth module
    power off when in USB mode
    power off by FET switch

AVR configuration
    unused pins
    ADC
    


SET CONTROL CONFIG
------------------
    SET CONTROL CONFIG 4810
    SET CONTROL CONFIG LIST
    SET CONTROL CONFIG 0000 0000 4910 DEEP_SLEEP KLUDGE INTERACTIVE_PIN UART_LATENCY

    Bit14   UART low latency
    Bit11   Interactive pairing mode
    Bit04   Deep sleep


Reconnection
------------
SET CONTROL AUTOCALL 1124 5000 HID
    1124    HID service class
    5000    interval ms

HID profile
-----------
This is needed to configure only once.
    SET PROFILE HID ON
    RESET

HID class
---------
    SET BT CLASS 005C0  // keyboard/mouse combined devie

Pairing Security
----------------
Secure Simple Pairing(SSP)
    SET BT SSP 2 0  // Enables SSP for keyboard and Man-in-the-middle protection
    SET BT SSP 3 0  // Enables SSP just works mode

for keyboard with SSP
    SET BT AUTH * 0000
    SET BT SSP 2 0
    SET CONTROL CONFIG 800
    RESET

for keyboard without SSP
    SET BT AUTH * 0000
    SET CONTROL CONFIG 800
    RESET

AUTH
    AUTH xx:xx:xx:xx:xx:xx?         // Pairing request event
    AUTH xx:xx:xx:xx:xx:xx  0000

    SSP PASSKEY 78:dd:08:b7:e4:a2 ?
    SSP PASSKEY 78:dd:08:b7:e4:a2 xxxxx
    (SSP COMPLETE 78:dd:08:b7:e4:a2 HCI_ERROR_AUTH_FAIL     // failed)
    RING 0 78:dd:08:b7:e4:a2 11 HID

Connecton
    RING xx:xx:xx:xx:xx:xx xx HID   // connection event

    KILL xx:xx:xx:xx:xx:xx

Mode
----
Command mode
Data mode
    Raw mode
    (Simple mode         not for a real keyboard)

Raw mode
    Keyboard:
    0x9f, length(10), 0xa1, 0x01, mods, 0x00, key1, key2, key3, key4, key5, key6

    Mouse:
    0x9f, length(5), 0xa1, 0x02, buttons, X, Y

    Consumer page:
    0x9f, length(5), 0xa1, 0x03, bitfield1, bitfield2, bitfield3

    consumer page suage
    Bitfield 1:
        0x01 Volume Increment
        0x02 Volume Decrement
        0x04 Mute
        0x08 Play/Pause
        0x10 Scan Next Track
        0x20 Scan Previous Track
        0x40 Stop
        0x80 Eject
    Bitfield 2:
        0x01 Email Reader
        0x02 Application Control Search
        0x04 AC Bookmarks
        0x08 AC Home
        0x10 AC Back
        0x20 AC Forward
        0x40 AC Stop
        0x80 AC Refresh
    Bitfield 3:
        0x01 Application Launch Generic Consumer Control
        0x02 AL Internet Browser
        0x04 AL Calculator
        0x08 AL Terminal Lock / Screensaver
        0x10 AL Local Machine Browser
        0x20 AC Minimize
        0x40 Record
        0x80 Rewind





2011/07/13
set
SET BT BDADDR 00:07:80:47:22:14
SET BT NAME HHKB pro BT
SET BT CLASS 0005c0
SET BT AUTH * 0000
SET BT IDENT BT:47 f000 4.1.0 Bluegiga iWRAP
SET BT LAP 9e8b33
SET BT PAGEMODE 4 2000 1
SET BT PAIR 78:dd:08:b7:e4:a2 a191189cd7e51030ad6a07848ce879bb
SET BT POWER 3 3 3
SET BT ROLE 0 f 7d00
SET BT SNIFF 0 20 1 8
SET BT SSP 2 1
SET BT MTU 667
SET CONTROL AUTOCALL 1124 3000 HID
SET CONTROL BAUD 38400,8n1
SET CONTROL CD 00 0
SET CONTROL ECHO 7
SET CONTROL ESCAPE 43 00 1
SET CONTROL GAIN 0 5
SET CONTROL INIT SET CONTROL MUX 0
SET CONTROL MSC DTE 00 00 00 00 00 00
SET CONTROL MUX 1
SET CONTROL PIO 00 00
SET CONTROL READY 00
SET PROFILE HID f HID
SET

info config

!!! THIS IS BETA RELEASE AND MAY BE USED FOR EVALUATION PURPOSES ONLY !!!

WRAP THOR AI (4.1.0 build 435)
Copyright (c) 2003-2011 Bluegiga Technologies Inc.
Compiled on Jun 28 2011 17:19:51, running on WT12-A module, psr v31
        AVRCP BGIO FTP HFP HFP_AG HID HID_CONSUMER_PAGE HSP LEDS MAP OTA PBAP PIO=0x00fc SSP SUBRATE TEST VOLUME
        - BOCK3 version 435 (Jun 28 2011 17:19:37) (max acl/sco 7/1)
        - Bluetooth version 2.1, Power class 2
        - Loader 4279, firmware 6297 (56-bit encryption), native execution mode
        - up 0 days, 06:23, 2 connections (pool 2)
        - User configuration:
&028a = 0001 0000 0000 0011 0024 0000 0000 0010 0000 0080 0000 0000 0080 005f 009b 0034 00fb 0006
&028b = 0000 0bb8
&028d = 0001
&0295 = 0000 0005 000b 0000 0003 0000 0000 0000 0000 0000 0000
&0298 = a006
&0299 = 0000 0000
&02a3 = 0030 0030 0030 0030
&02a4 = 009d 0000
&02a5 = 0053 0045 0054 0020 0043 004f 004e 0054 0052 004f 004c 0020 004d 0055 0058 0020 0030
&02a7 = 0000 05c0
&02a8 = 4910 0000 0000
&02aa = 0004 2000 0001 0033 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
&02ac = 0000 0000 002b 0000 0000 0000 0000 0000 0000 0000 0002 0000 0000 0000 0010 0000 0000 0000 0000 029b 0000 0000 0000 0000
&02ad = 4848 424b 7020 6f72 4220 0054
&02b3 = 0005 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003
&02b7 = 000f 4948 0044
&02bb = 8000
READY.




2011/07/07 settings:
set
SET BT BDADDR 00:07:80:47:22:14
SET BT NAME HHKB Pro BT
SET BT CLASS 0005c0
SET BT AUTH * 000
SET BT IDENT BT:47 f000 4.0.0 Bluegiga iWRAP
SET BT LAP 9e8b33
SET BT PAGEMODE 4 2000 1
SET BT PAIR 78:dd:08:b7:e4:a2 9e54d0aabb1b4d73cfccddb1ea4ef2d6
SET BT POWER 3 3 3
SET BT ROLE 0 f 7d00
SET BT SNIFF 0 20 1 8
SET BT SSP 3 0
SET BT MTU 667
SET CONTROL BAUD 38400,8n1
SET CONTROL CD 00 0
SET CONTROL ECHO 7
SET CONTROL ESCAPE 255 00 1
SET CONTROL GAIN 0 5
SET CONTROL INIT set control mux 0
SET CONTROL MSC DTE 00 00 00 00 00 00
SET CONTROL PREAMP 1 1
SET CONTROL READY 00
SET PROFILE HID HID
SET PROFILE SPP Bluetooth Serial Port
SET

info config
WRAP THOR AI (4.0.0 build 317)
Copyright (c) 2003-2010 Bluegiga Technologies Inc.
Compiled on Apr 20 2010 16:44:28, running on WT12-A module, psr v31
        AVRCP FTP PBAP PIO=0x00fc SSP SUBRATE VOLUME
        - BOCK3 version 317 (Apr 20 2010 16:44:21) (max acl/sco 7/1)
        - Bluetooth version 2.1, Power class 2
        - Loader 4279, firmware 6297 (56-bit encryption), native execution mode
        - up 0 days, 00:00, 0 connections (pool 1)
        - User configuration:
&028c = 0001 0020 0000 0001 0008 0000
&028d = 0000
&0296 = 0047 0001 f000 0400 6c42 6575 6967 6167 6920 5257 5041
&0298 = c006
&02a3 = 0030 0030 0030
&02a4 = 009d 0000
&02a5 = 0073 0065 0074 0020 0063 006f 006e 0074 0072 006f 006c 0020 006d 0075 0078 0020 0030
&02a7 = 0000 05c0
&02a8 = 0800 0000 0000
&02ac = 0000 0000 00ff 0000 0000 0000 0000 0000 0000 0000 0002 0000 0000 0000 0010 0000 0000 0000 0000 029b 0000 0000 0000 0000
&02ad = 4848 424b 5020 6f72 4220 0054
&02b3 = 0004 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003
&02b7 = 0000
&02bb = 6c42 6575 6f74 746f 2068 6553 6972 6c61 5020 726f 0074
READY.



2011/08/23:
SET BT BDADDR 00:07:80:47:22:14
SET BT NAME HHKB pro BT
SET BT CLASS 0005c0
SET BT AUTH * 0000
SET BT IDENT BT:47 f000 4.1.0 Bluegiga iWRAP
SET BT LAP 9e8b33
SET BT PAGEMODE 4 2000 1
SET BT PAIRCOUNT 4
SET BT POWER 3 3 3
SET BT ROLE 1 f 12c0
SET BT SNIFF 10 2 1 8
SET BT SSP 3 0
SET BT MTU 667
SET CONTROL BAUD 38400,8n1
SET CONTROL CD 00 0
SET CONTROL ECHO 7
SET CONTROL ESCAPE 43 00 1
SET CONTROL GAIN 0 5
SET CONTROL INIT SET CONTROL MUX 0
SET CONTROL MSC DTE 00 00 00 00 00 00
SET CONTROL MUX 1
SET CONTROL PIO 00 00
SET CONTROL READY 00
SET PROFILE HID 7 HIDKeyboardMouse
SET

SET CONTROL CONFIG 0000 0004 481e CLOCK_CACHE INTERLACED_INQ INTERLACED_PAGE DEEP_SLEEP INTERACTIVE_PIN UART_LATENCY 23D_NOKLUDGE



2011/08/25:
SET BT BDADDR 00:07:80:47:22:14
SET BT NAME HHKB pro BT
SET BT CLASS 0005c0

SET BT IDENT BT:47 f000 4.1.0 Bluegiga iWRAP
SET BT LAP 9e8b33
SET BT PAGEMODE 4 2000 1
SET BT PAIRCOUNT 4
SET BT PAIR 78:dd:08:b7:e4:a2 0be83335a03fed8ededae42e99554e28
SET BT POWER 3 3 3
SET BT ROLE 1 f 12c0
SET BT SNIFF 100 20 1 8
SET BT SSP 3 0
SET BT MTU 667
SET CONTROL BAUD 38400,8n1
SET CONTROL CD 00 0
SET CONTROL ECHO 7
SET CONTROL ESCAPE - 20 1
SET CONTROL GAIN 0 5
SET CONTROL INIT SET CONTROL MUX 0
SET CONTROL MSC DTE 00 00 00 00 00 00
SET CONTROL MUX 1
SET CONTROL PIO 00 00
SET CONTROL READY 00
SET PROFILE HID f HIDKeyboardMouse
SET


SET CONTROL CONFIG 0000 0000 490e CLOCK_CACHE INTERLACED_INQ INTERLACED_PAGE KLUDGE INTERACTIVE_PIN UART_LATENCY


2011/09/08:
SET CONTROL CONFIG 0000 0000 410e CLOCK_CACHE INTERLACED_INQ INTERLACED_PAGE KLUDGE UART_LATENCY

    Removed INTERACTIVE_PIN to avoid interactive auth and use SET BT AUTH pin(0000).


EOF