Files
OpenCellular/chip
Bill Richardson d67f83a63c Use sample averaging on ADC to increase accuracy
The AC adapter detection isn't measuring the expected values, most likely
because we're not providing enough current for the ADC circuitry to sample.
This tells the ADC to take 64 samples for every reading and average them
together. That seems to fix it.

BUG=chrome-os-partner:19594
BRANCH=none
TEST=manual

To test, use a scope to probe the voltage pin 6 of the AC adapter connector.
Compare that with the measured result from the ADC, by using the EC
console's "adc" command.

Before this change:

  Adapter   Probed(mV)    ADC(mV)   error
    45W       469          415       11.5%
    65W       600          530       11.6%
    90W       794          701       11.7%

After this change:

  Adapter   Probed(mV)    ADC(mV)   error
    45W       469          452       3.6%
    65W       600          590       1.6%
    90W       794          773       2.6%

Close enough.

Change-Id: I5ab5526934a5a2711969a90a26631d54c7863da7
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/61346
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-07-09 18:56:36 -07:00
..
2013-06-10 20:21:37 -07:00