Keyboard firmwares for Atmel AVR and Cortex-M
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MEMO.txt 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  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. TODO
  7. ----
  8. - Factroy reset doesn't work; need to test again. 10K pull-up is too high?
  9. - Lipo voltage ADC sensing
  10. - Lipo charger configuration: fast charge time: USB charger spec?
  11. - Low voltage alarm: LED indcates voltage of Lipo
  12. - CTS/RTS lines are needed? just connect in loop back if no flow control is needed.
  13. - CTS is needed for waking up from deep sleep?
  14. - Serial API callback when data are available/received(and when send buffer is available)
  15. - Serial API instance several serial ports can be used
  16. - DCDC converter: squeaky inducter with onsemi NCP1402
  17. - Lipo charger MCP73831: needs capacitor 4.7uF *2
  18. - Keymap layer bug: during space is pressed(mousekey) press Fn(HHKB) then release space before Fn, in result HHKB layer is locked(toggled) unintentionally.
  19. DONE:
  20. - USB connection check - 07.01
  21. - BT on/off check: whether RX line is pulled up? - checking RTS 07.01
  22. - USB/BT switching BT is on -> BT, BT is off -> USB - 07.01
  23. - Under voltage lock out UVLO for protection of Lipo - Lipo has discharge protection at 3.100V 07.01
  24. - Power saving: HHKB scan, BT radio control - 9h with 850mAh, this is enough 07.01
  25. - Power selector doesn't work; Q4 MOSFET leaks from Lipo to USB power line. -- use Schottky instead 07/04
  26. Lipo
  27. ----
  28. Sparkfun Polymer Lithium Ion Battery 850mAh:
  29. https://www.sparkfun.com/products/341
  30. Lipo Cell spec:
  31. https://www.sparkfun.com/datasheets/Batteries/063048%20Li-polymer.pdf
  32. Protection spec:
  33. http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Prototyping/BatteryProtection.pdf
  34. min typical max
  35. over-charge 4.255 4.280 4.305
  36. over-charge discover? 4.030 4.080 4.130
  37. over-discharge 2.827 2.900 2.973
  38. over-discharge discover 3.022 3.100 3.178
  39. ADC voltage monitor: voltage divider 10K+10K(0.5)
  40. ADC=V*0.5/2.56*1024
  41. V ADC
  42. ------------------
  43. 4.20 0x347(839)
  44. 3.10 0x26b(619)
  45. Configuration
  46. -------------
  47. Ver 6.15 04/26/2013
  48. (c) Roving Networks
  49. ***Settings***
  50. BTA=0006664B3AE3
  51. BTName=tmkBT-3AE3
  52. Baudrt(SW4)=115K
  53. Mode =DTR
  54. Authen=2
  55. Bonded=0
  56. Rem=000000000000
  57. ***ADVANCED Settings***
  58. SrvName= keyboard/mouse
  59. SrvClass=0000
  60. DevClass=0000
  61. InqWindw=0100
  62. PagWindw=0100
  63. CfgTimer=255
  64. StatuStr=NULL
  65. HidFlags=3c
  66. DTRtimer=8
  67. KeySwapr=0
  68. ***OTHER Settings***
  69. Profile= HID
  70. CfgChar= $
  71. SniffEna=8010
  72. LowPower=0
  73. TX Power=0
  74. IOPorts= 0
  75. IOValues=0
  76. Sleeptmr=0
  77. DebugMod=0
  78. RoleSwch=0
  79. Serial connection
  80. -----------------
  81. Serial line: 115200bps, 8bit, 1-stopbit, non-parity, no flow control
  82. SSP: 115200bps, 8bit, 1-stopbit, non-parity, no flow control(via Bluetooth)
  83. To enter command mode disconnect the module from host and type '$$$'.(you will see 'CMD')
  84. To exit type '---'(you will see 'END') and '+' to get local echo.
  85. Setting command mode
  86. --------------------
  87. S-,tmkBT // Device name
  88. SS,keyboard/mouse // service name
  89. SM,4 // Auto Connect DTR mode
  90. SW,8010 // Sniff enable 0x10*0.625ms=10ms; 50ms is laggish and not much power save
  91. S~,6 // HID profile
  92. SH,003C // HID register
  93. SY,0004 // Transmit power
  94. Other options:
  95. SC,0000 // COD: 000005C0 (see HID spec/Bluegiga doc)
  96. SD,05C0 // bit 12-8 7 6 5-0
  97. // 00101 1 1 0
  98. // peripheral pointing keybaord joystick, gamepad, ...
  99. SM,6 // Pairing mode: auto connect
  100. SM,4 // Master mode: Connection can be controled with GPIO6
  101. HID profile
  102. -----------
  103. S~,6 HID profile
  104. S~,0 SPP profile
  105. R,1 reboot
  106. Apple iOS
  107. ---------
  108. Cannot supported without apple iAP authentication chip.
  109. HID flag register
  110. -----------------
  111. SH,0200
  112. GH
  113. 10 0000 0000(0200) default
  114. 00 0011 1000(0038) Combo
  115. || | | |\_\____ number of paired devices to which the module can reconnect
  116. || | | \_______ send out reports over UART (0xFF <len> <data>)
  117. || \__\_________ descriptor type
  118. |\______________ toggle virtual keyboard on iOS when first connected
  119. \_______________ Force HID mode if GPIO11 is high on power-up
  120. Descriptor type:
  121. 0000: keybaord
  122. 0001: Game Pad
  123. 0010: Mouse
  124. 0011: Combo
  125. 0100: Joystick
  126. 1xxx: reserved
  127. Out report - Indicator
  128. ----------------------
  129. 0xFE 0x02 0x01 <LED_state>
  130. LED Status
  131. ----------
  132. Configuring 10 times per sec
  133. Startup/configuration timer 2 times per sec
  134. Discoverable/Inquiring/Idle once per sec
  135. Connected solid on
  136. Pairing
  137. -------
  138. First, host initiates pairing process and once it is done, auto connect will work thereafter.
  139. SM,3 Master mode
  140. SM,4 Auto Connect DTR Mode uses GPIO6 to make and break connection(Mode =DTR)
  141. confirm: auto connect works and control connection with GPIO6
  142. SM,5 Auto Connect ANY Mode (Mode =ANY)
  143. each time GPIO is set, make inquiry and connect to the first found device
  144. SM,6 automatically reconnect(Mode =Pair)
  145. confirm: auto connect works well but difficult to enter command mode.
  146. Fast data mode
  147. --------------
  148. The module enters fast data mode after 'remote configuration timer' window is passed from power on.
  149. In this mode the module does not accept '$$$' to enter command mode.
  150. Power Management
  151. ----------------
  152. Inquiry and Page window Idle or Active (3.1.1)
  153. Downside: delay in discovery or connection time
  154. SI, // set inquiry scan window(discovery) on/off duty?
  155. SJ, // set page scan window(connection)
  156. This reduces averaege power >20mA to 5mA(3mA in Sniff mode)
  157. Sniff mode Transmit
  158. Sniff mode is disabled by default and radio is active continuously when connected.(25-30mA)
  159. In Sniff mode the radio wakes up intermittently and sleeps in very low power mode.(2mA)
  160. SW,<val> // set interval timer(*0.625ms) 0000-7FFF
  161. Deep sleep Idle (3.1.2)
  162. 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.
  163. SW,8320 // deep sleep enable(interval=0x320*0.625=500ms)
  164. 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.
  165. To wake from deep sleep there are three ways: (in worst case wake up takes 5ms)
  166. *send a charactor to the UART(first charactor will be lost)
  167. *toggle CTS low to high and wait 5ms
  168. *wake automatically every slot time(<val>*0.625ms)
  169. Once the radio is awake it stay active for exactly 1 second of inactivity and then sleeps again.
  170. Downside: latency and data loss
  171. Disable Output driver Idle or Active (3.1.3)
  172. S%,1000 // set all GPIO pins(0-11) to inputs.
  173. Lower Transmit Power Idle or Active (3.1.4)
  174. SY,<hex> // transmit power setting(takes effect after a power cycle and reboot)
  175. Downside: reducing effective range
  176. Optimizig for Latency
  177. ---------------------
  178. By default the firmware is optimized for throughput.
  179. SQ,16 // set latency bit
  180. SQ,0 // unset latency bit
  181. Configuration timer settings
  182. ----------------------------
  183. Remote configuration is used for the module to be configured with various commands over Bluetooth(SPP profile only?).
  184. 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.)
  185. ST,0 // no remote, no local when connected
  186. ST,<1-252> // local and remote with timeout in seconds from power up
  187. ST,253 // local only without timeout
  188. ST,254 // remote only without timeout
  189. ST,255 // local and remote without timeout
  190. Android
  191. -------
  192. 3.7.1.5 Note: To connect with Android phone the modules must wake up 11ms every 2.5seconds.
  193. Commands
  194. --------
  195. SC,
  196. SM,<val>
  197. SD,
  198. SP,<string> Pin code(alpahnumeric)
  199. SQ,<mask> Special configuration(GPIO, discovery mode, low latency, reboot, UART)
  200. SR,<hex> Store remote address
  201. SR,Z Erase all address
  202. SS,<string> Set service name(1-20)**
  203. ST,<val> Remote configuration timer(Master:0, Slave:0-255, Triger:as idle timer)
  204. SU,<val> UART baud rate
  205. SW,<val> low-power sniff mode** deep sleep and wake up every 625us * <val>
  206. SX,<0|1> bonding enable only acceps device that matches the stored address
  207. SY,<hex> power setting**
  208. SZ,<val> non-standard raw baud rate <val>=baud*0.004096
  209. S~,<val> Profile 0:SPP, 5:APL, 6:HID
  210. S-,<string> Device name -15 alphanumeric charactors
  211. S?,<0|1> role switch enable
  212. S$,<char> command mode char
  213. $|,<hex> low-power connect mode deep sleep/active(discoverable and connectable) cycle
  214. D display basic setting
  215. E display extended setting
  216. GB display the device's Bluetooth address
  217. GF display Bluetooth address of connected device
  218. GK show connection status
  219. GR show remote address for reconnecting
  220. G& show GPIO pin
  221. G<char> show stored setting
  222. + toggle local echo on/off
  223. & show GPIO 3,4,6,7(DIP switch)
  224. C connect to stored remote address
  225. C,<address> connect last address
  226. CFI connect and go into fast data mode
  227. CFR connect and go into fast data mode
  228. CT,<address>,<val> connect to the address and disconnect after val?
  229. F,1 fast data mod:
  230. H display help
  231. I,<time>,<cod> inquiry scan with <cod>
  232. IN
  233. IQ scan
  234. IS inquiry scan with 001F00
  235. J hide pin code
  236. K, kill disconnects current connection
  237. L link quality
  238. M show modem signlal status
  239. O display other settings
  240. P,<car> pass through?
  241. Q quiet mode make the module not discoverable
  242. Q,0 discoverable and connectable
  243. Q,1 not discoverable and not connectable
  244. Q,2 not discoverable and connectable
  245. Q,? display current quiet mode
  246. R,1 reboot
  247. T,<0|1> pass received data while in command mode
  248. U,<baud>,<parity> change UART setting tentatively
  249. V display firmware version
  250. W wake from quiet mode enable discovery and connection
  251. Z deep sleep mode(<2mA)