-
Notifications
You must be signed in to change notification settings - Fork 2.1k
cpu/stm32: add ADCAL operation #20044
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just two style nits:
- also prefix the commit message with
cpu/stm32
like you did for the PR title - use
/* this comment style */
instead of// this comment style
for consistency.
e478574
to
60fc505
Compare
This doesn't build on stm32f0 based boards and the ADC implementation is shared between f0 and g0:
I haven't checked the f0 datasheet to see if the changes in the PR could apply to f0 (which I doubt) so maybe just add some |
c8fa344
to
a0b9ff3
Compare
a0b9ff3
to
f44faf9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't test this yet, but code looks good.
Can you provide some results?
@benpicco I don't have hard numbers with me, but this change, coupled with the adjustment using Vrefint (to compensate for a moving or unknown Vref) got us an improvement of about 50-100mV in accuracy on the ADC reading. I don't have details to attribute which change provided more improvements, however. |
I think this needs a rebase due to the migration from bors to Github merge queues. @david-vankampen would you mind to rebase this on current master? |
@maribu looks like this should now be all set on that front? |
Fantastic, just minutes before the build was completed 😢 |
The STM32G0 has an ADC Calibration procedure ad described in RM0454 Section 14.3.3

Contribution description
Add the software calibration procedure on startup as described in STM's documentation.