stm32: Fix typo in adc startup delay

Fix (harmless) typo and add comments on adc timing.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor committed 2019-11-27 11:16:41 -05:00
1 parent 8d93d1a8ef
commit fc476f22b6
1 file changed
+6 -1
+6 -1
View File
@@ -34,6 +34,11 @@ static const uint8_t adc_pins[] = {
#define CR2_FLAGS ADC_CR2_ADON
#endif
// ADC timing:
// stm32f103: ADC clock=9Mhz, Tconv=12.5, Tsamp=28.5, total=4.556us
// stm32f407: ADC clock=21Mhz, Tconv=12, Tsamp=56, total=3.238us
// stm32f446: ADC clock=22.5Mhz, Tconv=12, Tsamp=56, total=3.022us
struct gpio_adc
gpio_adc_setup(uint32_t pin)
{
@@ -72,7 +77,7 @@ gpio_adc_setup(uint32_t pin)
#if CONFIG_MACH_STM32F1
// Perform calibration
udelay(timer_from_us(1));
udelay(10);
adc->CR2 = ADC_CR2_CAL | CR2_FLAGS;
while (adc->CR2 & ADC_CR2_CAL)
;