aboutsummaryrefslogtreecommitdiffstats
path: root/src/stm32/stm32f0.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stm32/stm32f0.c')
-rw-r--r--src/stm32/stm32f0.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/stm32/stm32f0.c b/src/stm32/stm32f0.c
index 26a3512c..f9eabeab 100644
--- a/src/stm32/stm32f0.c
+++ b/src/stm32/stm32f0.c
@@ -156,6 +156,16 @@ hsi48_setup(void)
#endif
}
+// Enable high speed internal 14Mhz clock for ADC
+static void
+hsi14_setup(void)
+{
+ // Enable HSI14 for ADC
+ RCC->CR2 = RCC_CR2_HSI14ON;
+ while (!(RCC->CR2 & RCC_CR2_HSI14RDY))
+ ;
+}
+
// Main entry point - called from armcm_boot.c:ResetHandler()
void
armcm_main(void)
@@ -179,6 +189,9 @@ armcm_main(void)
else
pll_setup();
+ // Turn on hsi14 oscillator for ADC
+ hsi14_setup();
+
// Support alternate USB pins on stm32f042
#ifdef SYSCFG_CFGR1_PA11_PA12_RMP
if (CONFIG_STM32F042_USB_PIN_SWAP) {