Skip to content

stmhal/adc.c: Fix calculation of read_core_vref() - #1102

Merged
dpgeorge merged 1 commit into
micropython:masterfrom
blmorris:adc_vrefint_calc
Feb 6, 2015
Merged

stmhal/adc.c: Fix calculation of read_core_vref()#1102
dpgeorge merged 1 commit into
micropython:masterfrom
blmorris:adc_vrefint_calc

Conversation

@blmorris

@blmorris blmorris commented Feb 6, 2015

Copy link
Copy Markdown
Contributor

There was a stray factor of 2 (VBAT_DIV) that looks like it was copied incorrectly from the read_core_vbat() function.
The factor exists in read_core_vbat() because VBAT is measured through a 2:1 voltage divider.
read_core_vref() now returns values around 1.21V (assuming that external reference voltage is 3.3V) which is in line with the datasheet.
See comment at http://forum.micropython.org/viewtopic.php?f=6&t=533&p=2991#p2991

There was a stray factor of 2 (VBAT_DIV) that looks like it was copied incorrectly from the read_core_vbat() function.
The factor exists in read_core_vbat() because VBAT is measured through a 2:1 voltage divider.
read_core_vref now returns values around 1.21V (assuming that external reference voltage is 3.3V) which is in line with the datasheet values.
See comment at http://forum.micropython.org/viewtopic.php?f=6&t=533&p=2991#p2991
@dpgeorge
dpgeorge merged commit 97f1460 into micropython:master Feb 6, 2015
@dpgeorge

dpgeorge commented Feb 6, 2015

Copy link
Copy Markdown
Member

Thanks!

@blmorris
blmorris deleted the adc_vrefint_calc branch February 6, 2015 21:53
@dpgeorge

Copy link
Copy Markdown
Member

4096/4095 bug now fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants