From 4df0ba5c6a79de04448d306ab4d52c65fb590a9b Mon Sep 17 00:00:00 2001 From: Steins7 Date: Sun, 3 Nov 2024 22:23:26 +0100 Subject: [PATCH] Fix RCC's speed preset not working in release Since rcc_configure should always be called before anything else, short timing depends on hard coded loops. These are too fast in release... --- drv/rcc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drv/rcc.c b/drv/rcc.c index f755b0a..e36fe45 100644 --- a/drv/rcc.c +++ b/drv/rcc.c @@ -163,7 +163,7 @@ static void apply_speed_preset(void) //try enabling HSE, fallback to HSI if HSE fails regs->CR.HSEON = 1; - for (uint32_t i=0; i<1000; ++i) { + for (uint32_t i=0; i<10000; ++i) { __asm__("nop"); } if (regs->CR.HSERDY == 0x1) { @@ -175,7 +175,7 @@ static void apply_speed_preset(void) //configure PLL, fallback to HSI if PLL fails regs->CFGR.PLLMUL = 0x7; //PLL x9 regs->CR.PLLON = 1; - for (uint32_t i=0; i<1000; ++i) { + for (uint32_t i=0; i<10000; ++i) { __asm__("nop"); } if (regs->CR.PLLRDY != 0x1) {