Support boards with no HSE (#4931)

* ENABLE_AUTO_DETECT_HSE: allow override from board config or board.mk

* Cleanup comments references to removed rtcWorks variable

* Allow board with no HSE oscillator
This commit is contained in:
Andrey G 2023-01-03 23:01:51 +03:00 committed by GitHub
parent c9d88d2605
commit 1ddd871f8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 13 deletions

View File

@ -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);

View File

@ -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

View File

@ -16,7 +16,7 @@
#include "pch.h"
#ifdef ENABLE_AUTO_DETECT_HSE
#if ENABLE_AUTO_DETECT_HSE
float hseFrequencyMhz;
uint8_t autoDetectedRoundedMhz;

View File

@ -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

View File

@ -503,6 +503,6 @@
#define STM32_SYSCLK STM32_SYS_CK
#define ENABLE_AUTO_DETECT_HSE
#define ENABLE_AUTO_DETECT_HSE TRUE
#endif /* MCUCONF_H */

View File

@ -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[] = {