aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms/STM32F0xx
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/platforms/STM32F0xx')
-rw-r--r--os/hal/platforms/STM32F0xx/adc_lld.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/os/hal/platforms/STM32F0xx/adc_lld.c b/os/hal/platforms/STM32F0xx/adc_lld.c
index 95e0ddf77..51905c3d4 100644
--- a/os/hal/platforms/STM32F0xx/adc_lld.c
+++ b/os/hal/platforms/STM32F0xx/adc_lld.c
@@ -151,6 +151,14 @@ void adc_lld_init(void) {
disabled.*/
nvicEnableVector(ADC1_COMP_IRQn,
CORTEX_PRIORITY_MASK(STM32_ADC_IRQ_PRIORITY));
+
+ /* Calibration procedure.*/
+ rccEnableADC1(FALSE);
+ chDbgAssert(ADC1->CR == 0, "adc_lld_init(), #1", "invalid register state");
+ ADC1->CR |= ADC_CR_ADCAL;
+ while (ADC1->CR & ADC_CR_ADCAL)
+ ;
+ rccDisableADC1(FALSE);
}
/**