stm32: Fix ADC on stm32f042

It seems the stm32f042 chip needs a small delay during ADC enable.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2021-12-24 19:27:04 -05:00
parent 9f31a35e75
commit 247cd753e2
1 changed files with 1 additions and 0 deletions

View File

@ -91,6 +91,7 @@ gpio_adc_setup(uint32_t pin)
;
// Enable ADC
adc->ISR = ADC_ISR_ADRDY;
adc->ISR; // Dummy read to make sure write is flushed
adc->CR = CR_FLAGS | ADC_CR_ADEN;
while (!(adc->ISR & ADC_ISR_ADRDY))
;