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