cpu/stm32: add ADCAL operation#20044
Conversation
benpicco
left a comment
There was a problem hiding this comment.
Just two style nits:
- also prefix the commit message with
cpu/stm32like you did for the PR title - use
/* this comment style */instead of// this comment stylefor 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
benpicco
left a comment
There was a problem hiding this comment.
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.