From f44ddf645baf57b50fa0e51cbb9be337418a3d43 Mon Sep 17 00:00:00 2001 From: Alexander Heldt Date: Mon, 30 Dec 2024 11:47:54 +0100 Subject: [PATCH] Turn off `HSI` earlier --- src/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index 26025cc..8129bf2 100644 --- a/src/main.c +++ b/src/main.c @@ -17,6 +17,9 @@ static void system_clock_init(void) { PWR->CR &= ~(PWR_CR_VOS_MASK << PWR_CR_VOS_BIT); PWR->CR |= (PWR_SCALE3 << PWR_CR_VOS_BIT); + // Turn off HSI (which is on by default) + RCC->CR &= ~RCC_CR_HSION_ON; + // Turn on HSE RCC->CR |= RCC_CR_HSEON_ON; @@ -68,9 +71,6 @@ static void system_clock_init(void) { // Wait indefinitely for PLL clock to be selected // TODO indicate error/timeout somehow? while (((RCC->CFGR >> RCC_CFGR_SWS_BIT) & RCC_CFGR_SWS_MASK) != RCC_CFGR_SWS_PLL); - - // Turn off HSI (which is on by default) - RCC->CR &= ~RCC_CR_HSION_ON; } int main(void) {