summaryrefslogtreecommitdiff
path: root/rcc
diff options
context:
space:
mode:
authorKarl Palsson <karlp@etactica.com>2021-09-17 15:18:13 +0200
committerKarl Palsson <karlp@tweak.net.au>2022-01-20 19:01:51 +0100
commit3da2028a769f03ea3ea4fa1b3d69d0bf19af3b1e (patch)
tree4ff845a7dc0c8de6e5c88a5f146a69021ee17f94 /rcc
parent8a73b0bb09eb96068ff02696eb1055a36349b6bf (diff)
platforms: stm32f3: make functional
Sufficient for blinking leds. Not much else tested yet. Signed-off-by: Karl Palsson <karlp@etactica.com>
Diffstat (limited to 'rcc')
-rw-r--r--rcc/rcc.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/rcc/rcc.cpp b/rcc/rcc.cpp
index 5a7e29e..25ed29c 100644
--- a/rcc/rcc.cpp
+++ b/rcc/rcc.cpp
@@ -7,13 +7,13 @@ void rcc_init() {
flash_init();
#if defined(STM32F1) || defined(STM32F3)
-
- // Enable HSE.
+ // Enable (assumed 8MHz!) HSE
RCC->CR |= 0x10000;
while(!(RCC->CR & 0x20000));
-
- // Configure and enable PLL.
- RCC->CFGR = 0x1d0000;
+
+ // Configure and enable PLL from HSE.
+ auto pll_mul = 9;
+ RCC->CFGR = ((pll_mul-2)<<18) | (0x2 << 15);
RCC->CR |= 0x1000000;
while(!(RCC->CR & 0x2000000));