altos/stm: Make flash loader work with either 8MHz or 16MHz xtal
authorKeith Packard <keithp@keithp.com>
Sat, 13 Oct 2018 14:50:59 +0000 (07:50 -0700)
committerKeith Packard <keithp@keithp.com>
Sat, 13 Oct 2018 14:50:59 +0000 (07:50 -0700)
Provide PLL definitions for both values.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/stm/ao_flash_stm_pins.h

index d5893c8..b82046d 100644 (file)
 
 #include <ao_flash_pins.h>
 
+#ifndef AO_PLLMUL
+
+#if AO_HSE == 8000000
+
 /* PLLVCO = 96MHz (so that USB will work) */
 #define AO_PLLMUL              12
 #define AO_RCC_CFGR_PLLMUL     (STM_RCC_CFGR_PLLMUL_12)
 #define AO_PLLDIV              3
 #define AO_RCC_CFGR_PLLDIV     (STM_RCC_CFGR_PLLDIV_3)
 
+#endif
+
+#if AO_HSE == 16000000
+
+/* PLLVCO = 96MHz (so that USB will work) */
+#define AO_PLLMUL              6
+#define AO_RCC_CFGR_PLLMUL     (STM_RCC_CFGR_PLLMUL_6)
+
+/* SYSCLK = 32MHz */
+#define AO_PLLDIV              3
+#define AO_RCC_CFGR_PLLDIV     (STM_RCC_CFGR_PLLDIV_3)
+
+#endif
+
+#endif
+
 /* HCLK = 32MHZ (CPU clock) */
 #define AO_AHB_PRESCALER       1
 #define AO_RCC_CFGR_HPRE_DIV   STM_RCC_CFGR_HPRE_DIV_1