Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
Dieses Repo ist archiviert. Du kannst Dateien sehen und es klonen, kannst aber nicht pushen oder Issues/Pull-Requests öffnen.

MEMO.txt 14KB

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