-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nuvoton M487 ADC Accuracy using AnalogIn() #15419
Comments
#15422 fixes it |
To extend M487 EADC sampling time like below, //--------------ADD THIS LINE OF CODE TO IMPROVE ACCURACY---------------------
EADC_SetExtendSampleTime(eadc_base, chn, 0xF); //ADC produces much more accurate readings when this line is added. at least 0xF of extended sample time is needed. more is better.
//---------------------------------------------------------------- This can be done through M487 target configuration: Lines 7761 to 7763 in 8779918
For example, in {
"target_overrides": {
"NUMAKER_IOT_M487": {
"target.eadc-extsmpt-list": "{A0, 20}, {A1, 21}"
}
} |
#15422 was merged, shall this be closed? |
Yes, this can be closed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description of defect
Nuvoton M480 ADC accuracy is not good when using the mbed AnalogIn() object. This is especially true if there is any inline resistance (high impedance voltage source).
All of the Nuvoton SampleCode projects for the EADC have a line of code that calls the function EADC_SetExtendSampleTime(). For example, if you look at line 79 in EADC_TempSensor/main.c it looks like this
Target(s) affected by this defect ?
This has been observed on the Nuvoton M487
Toolchain(s) (name and version) displaying this defect ?
ARM_GCC 10.3.1
What version of Mbed-os are you using (tag or sha) ?
6.17.0
What version(s) of tools are you using. List all that apply (E.g. mbed-cli)
mbed cli 1.10.5
How is this defect reproduced ?
Configure a pin as AnalogIn() and read the value of a known input voltage. Note the accuracy. The accuracy will be much worse if there is any series resistance (e.g. a high impedance voltage source)
Modify mbed function called analogin_init() in analogin_api.c
The code above uses a hard-coded value of 0xF. Ideally this would be somehow configurable on a per-channel basis. Is this possible?
The text was updated successfully, but these errors were encountered: