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 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. Memo of deveopment
  2. ==================
  3. just memo, NOT WORTH READING
  4. 2015/11/24
  5. JP Bluetooth:
  6. RN-42 cannot send Japanese keys like; henkan, mu-henkan and kana, JPY and RO.
  7. It seems HID usage more than 0x65 cannot be send with the module.
  8. http://shiki.esrille.com/2014/07/bluetoothnisse.html
  9. Bug:
  10. - Factory Reset PIO4 doesn't work
  11. - the reason is unclear - 12/08 NOT LOOK INTO ANY MORE
  12. - WORKAROUND: use serial pins(3.3V, GND, RX and TX)
  13. - SF,1 and R,1 to set factory defalult
  14. Todo:
  15. - LED cover and switch knob and new Slide Switch
  16. - RN42 auto configuration
  17. - configure the module as HID device every time powering up
  18. - this'll reduce work load of assembly
  19. - move rn42 to protocol directory when it becomes reusable stack
  20. - sendchar() in lufa.c no buffer
  21. - no buffering. character lost can be caused.
  22. - LUFA sendchar should be buffered and serial_uart.c buffur size is too large(256).
  23. - BT operations
  24. - disconnect
  25. - new connection
  26. - remove connection
  27. - sendchar() in lufa.c block loop - DONE 11/29
  28. - block loop when powered with AC adapter
  29. - FrameNumber is not updated when adapter powered
  30. Improving:
  31. - ADC resolution
  32. AVR120
  33. AVR32138
  34. - Enhancing ADC resolution by oversampling
  35. AVR121 http://www.atmel.com/images/doc8003.pdf
  36. - disable digital input buffer DIDR(7.8.6)
  37. Design:
  38. - suspend.h - DONE 11/26
  39. - remove argument from suspend_power_down() for backward compatitibility
  40. - remove MCU dependent power saving code from core/keyboard - DONE 11/23
  41. - it should be located in project matrix.c
  42. - HHKB matrix.c needs matrix_prev?
  43. - is_modified() is obsolete now. really needs?
  44. - ADC: removing AREF capacitor C10
  45. - seems to be better while usb powered
  46. - still bad while battery powered
  47. http://electronics.stackexchange.com/questions/105849/avcc-and-capacitor-using-adc
  48. - ADC: smaller resistors for voltage dividor
  49. - 1K + 1K: not improved. - 11/27
  50. LUFA:
  51. USB connection check: state of USB deivce
  52. - USB_DeviceState:
  53. USB_Deivce_State_t { Unattached, Powered, Default, Addressed, Configured*, Suspended* }
  54. Unattached: unpluged
  55. Powered: pluged with power adapter
  56. Default: enumerate process bigin
  57. Addressed: addressed
  58. Configured: enumerated
  59. Suspended: suspended
  60. - USB_IsInitialized: state of LUFA core setup
  61. becomes true in USB_Init() USBController_AVR8.c
  62. becomes false in USB_Disable() USBController_AVR8.c
  63. - USB_VBUS_GetStatus(): state of VBUS(power/connection)
  64. - USB_Disable() detaches, disables all interrupts, controller, PLL, regulater.
  65. - When connect to power adapter
  66. - event happened: CW or CSW or C or DDC
  67. - USB state: not configured
  68. - USB evnets
  69. - USB connect: CSWRWRW
  70. - USB connect but fail to enumeration: CWRWRWRWS
  71. - USB disconnect: D
  72. - Power adapter connect: CW, CSW, C
  73. - Power adapter disconnect: D
  74. Power saving:
  75. - Pro2 current consumption
  76. - active: 138.2mA(no device on Hub)
  77. - suspended: 30.9mA(WakeUp enabled DIPSW6)
  78. - suspended: 0mA->46.0mA(WakeUp disabled DIPSW6)
  79. - Pro current consumption
  80. - active: 54.0mA
  81. - suspended: 40.5mA(WakeUp enabled DIPSW6)
  82. - suspended: 0.3mA(WakeUp disabled DIPSW6)
  83. - RN42 3.3V
  84. - disconnected(Idle): 5mA (config mode)
  85. - connected(Active):
  86. SW,0000: 23-26mA
  87. SW,0010: 27-29mA worse than 0000 for unknown reason
  88. SW,0020: 17-19mA mouse NG
  89. SW,0030: 13-16mA laggy mouse NG
  90. SW,0050: 10-13mA laggy mouse NG
  91. - matrix power saving
  92. - power saving while externally powered and not while unpluged
  93. - confirm suspend mode lufa.c: matrix_power_*, suspend_wakeup_condition
  94. - 8MHz clock
  95. - When not connected in a few minutes get into deep sleep to save battery life
  96. - CTS is needed for waking up from deep sleep? How deep sleep is activated?
  97. - firmware controlled 3.3V DC converter to switch on/off BT module
  98. - sleep MCU and BT module(keyboard is not used)
  99. - deep sleep MCU and BT module(keyboard is not used for long time)
  100. - deep sleep MCU and turn off BT module(keyboard is not used and not connected)
  101. - Battery ADC; switching, high resistance
  102. - switching gnd end of divider with PF4
  103. - high resistor 100K/1M?
  104. capacitor 10nF
  105. http://www.eevblog.com/forum/beginners/measuring-battery-voltage-without-consuming-current/
  106. - During USB suspend change clock source to internal RC from external Xtal(6.8)
  107. - FRZCLK: you can freeze clock for power saving. still WAKEUPI and VBUSTI interrupts are available while freezing.(21.7.3)
  108. - Suspend: Clear Suspend Bit, Freeze clock, disable PLL, MCU sleep(21.13)
  109. - Voltage reference(8.1.1)
  110. - to reduce power consumption while power down mode
  111. - unset ADEN before sleep(24.7)
  112. Lipo
  113. ----
  114. 850mA lasts around 9 hours(07/28)
  115. Sparkfun Polymer Lithium Ion Battery 850mAh:
  116. https://www.sparkfun.com/products/341
  117. Lipo Cell spec:
  118. https://www.sparkfun.com/datasheets/Batteries/063048%20Li-polymer.pdf
  119. Protection spec:
  120. http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Prototyping/BatteryProtection.pdf
  121. min typical max
  122. over-charge 4.255 4.280 4.305
  123. over-charge discover? 4.030 4.080 4.130
  124. over-discharge 2.827 2.900 2.973
  125. over-discharge discover 3.022 3.100 3.178
  126. ADC voltage monitor: voltage divider 10K+10K(0.5)
  127. ADC=V*0.5/2.56*1024
  128. V ADC
  129. ------------------
  130. 4.20 0x347(839)
  131. 3.10 0x26b(619)
  132. TROUBLE SHOOT
  133. -------------
  134. 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.
  135. 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.
  136. 07/18 On Linux, had an USB related trouble; keyboard or console didn't work for some reason. Changing PID cured this problem. Very annoying, took very long time before resolved it.
  137. 12/07 rn42_rts() read 1 every time. R12 broke in open mode(no coductive), idk why, too much heat with soldering? and PF1 pin was not soldered.
  138. It resolved with resoldering PF1 and new resistor on R12.
  139. Done:
  140. - low battery alert(solid light) 09/04
  141. - *** Rev.E BT test *** - DONE
  142. - with MCP73832, new Schottky, tantalum caps - DONE 12/07
  143. * MCP73832 doesn't leak from Vcc pin when unpluged and battery powered
  144. 34mV vs 2.07V(MCP73831) at Vcc pin
  145. MCP73832 doesn't need revese protection diode D5
  146. * PMEG2010ER is very low VF while reverse current/voltage is high
  147. VF=0.96 vs 1.98(RB160M-30TR)with Fluke 175
  148. Anode of D11 is 680mV vs 20mV(RB160M-30TR)
  149. 780mV is still low < 1.4V VBUS plugin detection(21.11)
  150. this doesn't cause false VBUS detect
  151. and 780mV on MCP73832 Vcc pin is also no problem.
  152. D5 can be removed.
  153. - ADC divider switching - DONE 12/07
  154. * Drain and Source of Q4 Pch was reversed wrongly on Rev.E.
  155. - reverse current from Lipo charger - DONE 12/07
  156. * MCP73832 has no recverse current from Vcc pin unlike MCP73831
  157. - Rev.F design - DONE
  158. - current measure point - DONE 12/08
  159. - change value of cap 68->47 - DONE 12/08
  160. - PPTC land pattern: no solder jumper, use 0Ohm resistor instead - CANCEL 12/08
  161. - Q4 Pch FET: wrong Drain and Source - DONE 12/08
  162. - D5 can be removed. - DONE 12/08
  163. - BT_INDICATOR LED turns on wrongly when touching line or pin. -- pull-up enabled on PF6/GPIO2 08/30
  164. - Lipo charger configuration: fast charge time: USB charger spec? -- used 2kohm
  165. - use LED of charger to alarm low battery. LED should be powered directly from Lipo? - cancel; powered from VUSB
  166. - Use RTS in serial_uart.c to resolve missing chars from help message of RN-42 - done
  167. - CTS/RTS lines are needed? just connect in loop back if no flow control is needed. - done
  168. - add IO pin to charger status CHRG; LED control(low) and detect charge status(input HiZ) 07.24
  169. - LINKED: add trace on PIO2 to PF6 07.24
  170. - Lipo voltage ADC sensing
  171. - Lipo charger MCP73831: needs capacitor 4.7uF *2
  172. - USB connection check - 07.01
  173. - BT on/off check: whether RX line is pulled up? - checking RTS 07.01
  174. - USB/BT switching BT is on -> BT, BT is off -> USB - 07.01
  175. - Under voltage lock out UVLO for protection of Lipo - Lipo has discharge protection at 3.100V 07.01
  176. - Power saving: HHKB scan, BT radio control - 9h with 850mAh, this is enough 07.01
  177. - Power selector doesn't work; Q4 MOSFET leaks from Lipo to USB power line. -- use Schottky instead 07/04
  178. - wrongly suspended when powered from adapter without USB connection - DONE
  179. - suspend event may occur when plug into adapter
  180. - and never wake until conected to real USB line
  181. - without debug print via USB no problem; CSW(wake just after suspend as real USB line)
  182. - seems like USB print causes this problem after suspended
  183. - lose USB connection during power-down mode - DONE
  184. - USB initialize code in main() causes this - WRONG
  185. - Do not power-down during USB connection is active - DONE 11/11
  186. (USB_DeviceState == USB_DEVICE_Configured) is used to check USB connection
  187. matrix_power_down() matrix.c - 11/23
  188. - with Nexus5 keyboard and mouse are very laggy.
  189. Not confirmed. 01/15
  190. - switch BT host connections - CANCEL 01/15
  191. - switch next connection
  192. cannot switch connection with version 6.15 at least
  193. - When given power only from wall wart adapter - DONE? not confirmed 01/15
  194. - it sleeps. it should not sleep
  195. - Configured state without USB connection?
  196. - timer is slow while power down - DONE 11/26
  197. - time out interrupt is lost while power down?
  198. - interrupt of watchdog timer compensates timer counter(avr/suspend.c)
  199. - repeated CHARGING/FULL_CHARGED - No longer problem 01/15
  200. - In LTC sharp pulses are observed.
  201. - MCP has no pulse but still has a problem.
  202. - needs more wait before read pin state? - NO
  203. - USB plug-in fails while BT - No longer problem 01/15
  204. - it ends in suspend state
  205. - maybe, not responsive to host enumeration process due to power-down.
  206. - matrix_power_down() only when state is unattached - 11/26
  207. - need to observe a while