1 RN-42 Bluetooth Module Support
2 ==============================
3 Bluetooth controller board works with HHKB Pro2, JP, Type-S and Type-S JP and it supports both USB and Bluetooth as keyboard output protocol. Bluetooth module Roving Networks/Microchip RN-42 is installed on the board.
9 the module always connects to the last linked device. Remote address setting does not work as expected.
10 - HHKB JP requires case modification for power switch and LEDs.
11 without switch power controlled by MCU? Probably using 3.3V regulator enable pin power of RN-42 can be controlled.
12 - Wiress certification of RN-42
13 Japan, Korea, Taiwan, Europe, FCC, Canada
14 http://www.microchip.com/wwwproducts/Devices.aspx?product=RN42
17 - Lipo battery is not included. Cannot ship it from Japan due to regulations.
29 Configuring 10 times per sec
30 Startup/configuration timer 2 times per sec
31 Discoverable/Inquiring/Idle once per sec
37 Magic key combination is 'LShift+RShift' by default in case of HHKB.
41 ----- Bluetooth RN-42 Help -----
44 Del: enter/exit RN-42 config mode
45 Slck: RN-42 initialize
47 u: toggle Force USB mode
49 RN-42 info: displays information of the module on console.
50 battery voltage: displays current voltage of battery and uptime.
51 RN-42 initialize: does factory reset and configures RN-42
52 pairing: enters Pairing mode.
53 toggle Force USB mode: switch between USB and Bluetooth
58 You can tune/operate RN-42 yourself with config(command) mode.
61 2. run `hid_listen` command in console
62 3. turn on Bluetooth switch
63 4. press LShift+RShift+Delete(Fn+~) you will see output like followings:
65 Entering config mode ...
71 5. do config with RN-42 commands. See documentations of RN-42.
72 6. to exit also press LShift+RShift+Delete(Fn+~)
74 Exiting config mode ...
79 RN-42 Initial Configuration
80 ---------------------------
81 RN-42 is configured as SPP device at factory reset, you need to configure it as HID device. This is needed just once first time.
84 2. run `hid_listen` command in console
85 3. turn on Bluetooth switch
86 4. press LShift+RShift+ScrLk(Fn+O) you will see output like followings:
88 Entering config mode ...
111 Exiting config mode ...
113 5. output of command 'X' after cofiguration
126 ***ADVANCED Settings***
127 SrvName= Keyboard/Mouse
152 You can switch between USB and Bluetooth with pressing 'LShift+RShift+u'.
157 This disconnects current connect and enter pairing mode.
165 RN-42 Serial Connection
166 -----------------------
167 UART: 115200bps, 8bit, 1-stopbit, non-parity, no flow control
168 SSP: 115200bps, 8bit, 1-stopbit, non-parity, no flow control(via Bluetooth)
170 To enter command mode disconnect the module from host and type '$$$'.(you will see 'CMD') and type '+' to get local echo. To exit type '---'(you will see 'END').
175 S-,tmkBT // Device name
176 SS,keyboard/mouse // service name
177 SM,4 // Auto Connect DTR mode
178 SW,8010 // Sniff enable 0x10*0.625ms=10ms; 50ms is laggish and not much power save
181 SH,003C // HID register
182 SY,0004 // Transmit power
183 SC,0000 // COD: 000005C0 (see HID spec/Bluegiga doc)
184 SD,05C0 // bit 12-8 7 6 5-0
186 // peripheral pointing keybaord joystick, gamepad, ...
187 SM,6 // Pairing mode: auto connect
188 SM,4 // Master mode: Connection can be controled with GPIO6
189 SF,1 // Factroy reset
191 SR,Z // removes all remote addresses for reconnecting.
192 // can be used to connect another host
193 SR,I // registers last inquiry address
198 SM,3 Auto Connect Master mode
199 SM,4 Auto Connect DTR Mode uses GPIO6 to make and break connection(Mode =DTR)
200 confirm: auto connect works and control connection with GPIO6
201 SM,5 Auto Connect ANY Mode (Mode =ANY)
202 each time GPIO is set, make inquiry and connect to the first found device
203 SM,6 automatically reconnect(Mode =Pair)
204 confirm: auto connect works well but difficult to enter command mode.
212 10 0000 0000(0200) default
213 00 0011 1000(0038) Combo
214 || | | |\_\____ number of paired devices to which the module can reconnect
215 || | | \_______ send out reports over UART (0xFF <len> <data>)
216 || \__\_________ descriptor type
217 |\______________ toggle virtual keyboard on iOS when first connected
218 \_______________ Force HID mode if GPIO11 is high on power-up
229 Out report - Indicator
230 ----------------------
231 0xFE 0x02 0x01 <LED_state>
236 Keyboard can be used with iPhone, but mouse cannot.
241 3.7.1.5 Note: To connect with Android phone the modules must wake up 11ms every 2.5seconds.
246 Inquiry and Page window Idle or Active (3.1.1)
247 Downside: delay in discovery or connection time
248 SI, // set inquiry scan window(discovery) on/off duty?
249 SJ, // set page scan window(connection)
250 This reduces averaege power >20mA to 5mA(3mA in Sniff mode)
253 Sniff mode is disabled by default and radio is active continuously when connected.(25-30mA)
254 In Sniff mode the radio wakes up intermittently and sleeps in very low power mode.(2mA)
255 SW,<val> // set interval timer(*0.625ms) 0000-7FFF
257 Deep sleep Idle (3.1.2)
258 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.
259 SW,8320 // deep sleep enable(interval=0x320*0.625=500ms)
260 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.
261 To wake from deep sleep there are three ways: (in worst case wake up takes 5ms)
262 *send a charactor to the UART(first charactor will be lost)
263 *toggle CTS low to high and wait 5ms
264 *wake automatically every slot time(<val>*0.625ms)
265 Once the radio is awake it stay active for exactly 1 second of inactivity and then sleeps again.
266 Downside: latency and data loss
268 Disable Output driver Idle or Active (3.1.3)
269 S%,1000 // set all GPIO pins(0-11) to inputs.
271 Lower Transmit Power Idle or Active (3.1.4)
272 SY,<hex> // transmit power setting(takes effect after a power cycle and reboot)
273 Downside: reducing effective range
276 Optimizig for Latency
277 ---------------------
278 By default the firmware is optimized for throughput.
279 SQ,16 // set latency bit
280 SQ,0 // unset latency bit
283 Configuration timer settings
284 ----------------------------
285 Remote configuration is used for the module to be configured with various commands over Bluetooth(SPP profile only?).
287 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.)
288 ST,0 // no remote, no local when connected
289 ST,<1-252> // local and remote with timeout in seconds from power up
290 ST,253 // local only without timeout
291 ST,254 // remote only without timeout
292 ST,255 // local and remote without timeout
302 SM,<val> Operation mode
303 SP,<string> Pin code(alpahnumeric)
304 SQ,<mask> Special configuration(GPIO, discovery mode, low latency, reboot, UART)
305 SR,<hex> Store remote address
306 SR,Z Erase all address
307 SS,<string> Set service name(1-20)**
308 ST,<val> Remote configuration timer(Master:0, Slave:0-255, Triger:as idle timer)
309 SU,<val> UART baud rate
310 SW,<val> low-power sniff mode** deep sleep and wake up every 625us * <val>
311 SX,<0|1> bonding enable only acceps device that matches the stored address
312 SY,<hex> power setting**
313 SZ,<val> non-standard raw baud rate <val>=baud*0.004096
314 S~,<val> Profile 0:SPP, 5:APL, 6:HID
315 S-,<string> Device name -15 alphanumeric charactors
316 S?,<0|1> role switch enable
317 S$,<char> command mode char
318 $|,<hex> low-power connect mode deep sleep/active(discoverable and connectable) cycle
319 D display basic setting
320 E display extended setting
321 GB display the device's Bluetooth address
322 GF display Bluetooth address of connected device
323 GK show connection status
324 GR show remote address for reconnecting
326 G<char> show stored setting
327 + toggle local echo on/off
328 & show GPIO 3,4,6,7(DIP switch)
329 C connect to stored remote address
330 C,<address> connect last address
331 CFI connect and go into fast data mode
332 CFR connect and go into fast data mode
333 CT,<address>,<val> connect to the address and disconnect after val?
336 I,<time>,<cod> inquiry scan with <cod>
337 IN,<time>,<cod> inquiry scan with <cod>, return without BT name
338 IR inquiry scan with 0055AA
339 IS inquiry scan with 001F00
341 K, kill disconnects current connection
343 M show modem signlal status
344 O display other settings
345 P,<char> pass through?
346 Q quiet mode make the module not discoverable
347 Q,0 discoverable and connectable
348 Q,1 not discoverable and not connectable
349 Q,2 not discoverable and connectable
350 Q,? display current quiet mode
352 T,<0|1> pass received data while in command mode
353 U,<baud>,<parity> change UART setting tentatively
354 V display firmware version
355 W wake from quiet mode enable discovery and connection
356 Z deep sleep mode(<2mA)
359 Reset to Factory Default
360 ------------------------