diff --git a/firmware/console/eficonsole.cpp b/firmware/console/eficonsole.cpp index 8572201d18..8b95c960e1 100644 --- a/firmware/console/eficonsole.cpp +++ b/firmware/console/eficonsole.cpp @@ -46,7 +46,7 @@ static void sayHello() { efiPrintf(PROTOCOL_HELLO_PREFIX " with OPENBLT"); #endif -#ifdef ENABLE_AUTO_DETECT_HSE +#if ENABLE_AUTO_DETECT_HSE extern float hseFrequencyMhz; extern uint8_t autoDetectedRoundedMhz; efiPrintf(PROTOCOL_HELLO_PREFIX " detected HSE clock %.2f MHz PLLM = %d", hseFrequencyMhz, autoDetectedRoundedMhz); diff --git a/firmware/hw_layer/ports/stm32/mcuconf_common_f4_f7.h b/firmware/hw_layer/ports/stm32/mcuconf_common_f4_f7.h index 3210c1396f..2c8f6d5d04 100644 --- a/firmware/hw_layer/ports/stm32/mcuconf_common_f4_f7.h +++ b/firmware/hw_layer/ports/stm32/mcuconf_common_f4_f7.h @@ -385,12 +385,14 @@ /* Some boards need to know clock early on boot. * F429-Discovery board configures clock and then SDRAM early on boot */ #ifndef STM32_HSECLK - // Pretend we have a 25MHz external crystal. This value isn't actually used since we - // configure the PLL to start on the HSI oscillator, then compute HSE's speed at runtime - // and reconfigure the PLL appropriately. - #define STM32_HSECLK 25000000 + // Some boards has no HSE oscillator at all and obviously disable HSE detections + #ifndef ENABLE_AUTO_DETECT_HSE + // Pretend we have a 25MHz external crystal. This value isn't actually used since we + // configure the PLL to start on the HSI oscillator, then compute HSE's speed at runtime + // and reconfigure the PLL appropriately. + #define STM32_HSECLK 25000000 - // After boot, we will detect the real frequency, and adjust the PLL M value to suit - - #define ENABLE_AUTO_DETECT_HSE + // After boot, we will detect the real frequency, and adjust the PLL M value to suit + #define ENABLE_AUTO_DETECT_HSE TRUE + #endif #endif diff --git a/firmware/hw_layer/ports/stm32/osc_detector.cpp b/firmware/hw_layer/ports/stm32/osc_detector.cpp index 592ccf0d34..7bc95270d6 100644 --- a/firmware/hw_layer/ports/stm32/osc_detector.cpp +++ b/firmware/hw_layer/ports/stm32/osc_detector.cpp @@ -16,7 +16,7 @@ #include "pch.h" -#ifdef ENABLE_AUTO_DETECT_HSE +#if ENABLE_AUTO_DETECT_HSE float hseFrequencyMhz; uint8_t autoDetectedRoundedMhz; diff --git a/firmware/hw_layer/ports/stm32/stm32f4/cfg/mcuconf.h b/firmware/hw_layer/ports/stm32/stm32f4/cfg/mcuconf.h index dae775dc83..11e71adc4c 100644 --- a/firmware/hw_layer/ports/stm32/stm32f4/cfg/mcuconf.h +++ b/firmware/hw_layer/ports/stm32/stm32f4/cfg/mcuconf.h @@ -43,9 +43,12 @@ #define STM32_NO_INIT FALSE #define STM32_HSI_ENABLED TRUE #define STM32_LSI_ENABLED TRUE -#define STM32_HSE_ENABLED TRUE +/* Some boards may have no HSE */ +#ifndef STM32_HSE_ENABLED + #define STM32_HSE_ENABLED TRUE +#endif -// rusEfi would automatically detect if we have 32768 quartz osc - see 'rtcWorks' +// rusEfi would automatically detect if we have 32768 quartz osc // todo: apply LSE patch #define STM32_LSE_ENABLED FALSE diff --git a/firmware/hw_layer/ports/stm32/stm32h7/cfg/mcuconf.h b/firmware/hw_layer/ports/stm32/stm32h7/cfg/mcuconf.h index 5f18d1b349..988edf88d9 100644 --- a/firmware/hw_layer/ports/stm32/stm32h7/cfg/mcuconf.h +++ b/firmware/hw_layer/ports/stm32/stm32h7/cfg/mcuconf.h @@ -503,6 +503,6 @@ #define STM32_SYSCLK STM32_SYS_CK -#define ENABLE_AUTO_DETECT_HSE +#define ENABLE_AUTO_DETECT_HSE TRUE #endif /* MCUCONF_H */ diff --git a/firmware/hw_layer/rtc_helper.cpp b/firmware/hw_layer/rtc_helper.cpp index 01e0d5f189..b9f9c4b7f9 100644 --- a/firmware/hw_layer/rtc_helper.cpp +++ b/firmware/hw_layer/rtc_helper.cpp @@ -29,7 +29,7 @@ extern "C" int _gettimeofday(timeval* tv, void* tzvp) { #if EFI_RTC void initRtc() { efiPrintf("initRtc()"); - printDateTime(); // this would test RTC, see 'rtcWorks' variable, see #311 + printDateTime(); // this would test RTC, see #311 } static const char * const monthAbbrs[] = {