diff options
-rw-r--r-- | os/hal/ports/STM32/LLD/ADCv1/adc_lld.c | 15 | ||||
-rw-r--r-- | readme.txt | 2 |
2 files changed, 17 insertions, 0 deletions
diff --git a/os/hal/ports/STM32/LLD/ADCv1/adc_lld.c b/os/hal/ports/STM32/LLD/ADCv1/adc_lld.c index bd73a315f..2cb340e45 100644 --- a/os/hal/ports/STM32/LLD/ADCv1/adc_lld.c +++ b/os/hal/ports/STM32/LLD/ADCv1/adc_lld.c @@ -150,6 +150,14 @@ void adc_lld_init(void) { /* Calibration procedure.*/
rccEnableADC1(FALSE);
+
+ /* CCR setup.*/
+#if STM32_ADC_SUPPORTS_PRESCALER
+ ADC->CCR = STM32_ADC_PRESC << 18;
+#else
+ ADC->CCR = 0;
+#endif
+
osalDbgAssert(ADC1->CR == 0, "invalid register state");
ADC1->CR |= ADC_CR_ADCAL;
osalDbgAssert(ADC1->CR != 0, "invalid register state");
@@ -207,6 +215,13 @@ void adc_lld_stop(ADCDriver *adcp) { dmaStreamRelease(adcp->dmastp);
+ /* Restoring CCR default.*/
+#if STM32_ADC_SUPPORTS_PRESCALER
+ ADC->CCR = STM32_ADC_PRESC << 18;
+#else
+ ADC->CCR = 0;
+#endif
+
/* Disabling ADC.*/
if (adcp->adc->CR & ADC_CR_ADEN) {
adc_lld_stop_adc(adcp->adc);
diff --git a/readme.txt b/readme.txt index 3cffd8211..8ef07a213 100644 --- a/readme.txt +++ b/readme.txt @@ -96,6 +96,8 @@ - RT: Merged RT4.
- NIL: Merged NIL2.
- NIL: Added STM32F7 demo.
+- HAL: Fixed prescaler not initialized in STM32 ADCv1 (bug #725)
+ (backported to 16.1.5).
- HAL: Fixed missing DAC section in STM32F072 mcuconf.h files (bug #724)
(backported to 16.1.5).
- VAR: Fixed palSetMode glitching outputs (bug #723)(backported to 3.0.6
|