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