printing autoDetectedPllMValue in console

This commit is contained in:
rusefi 2021-07-14 12:42:09 -04:00
parent e80cd6481e
commit 7f8bdf7006
2 changed files with 9 additions and 2 deletions

View File

@ -42,6 +42,11 @@ static void sayHello(void) {
efiPrintf(PROTOCOL_HELLO_PREFIX " Compiled: " __DATE__ " - " __TIME__ "");
efiPrintf(PROTOCOL_HELLO_PREFIX " COMPILER=%s", __VERSION__);
#ifdef ENABLE_AUTO_DETECT_HSE
extern uint8_t autoDetectedPllMValue;
efiPrintf(PROTOCOL_HELLO_PREFIX " autoDetectedPllMValue=%d", autoDetectedPllMValue);
#endif /* ENABLE_AUTO_DETECT_HSE */
#if defined(STM32F4) || defined(STM32F7)
uint32_t *uid = ((uint32_t *)UID_BASE);
efiPrintf("UID=%x %x %x", uid[0], uid[1], uid[2]);

View File

@ -19,6 +19,8 @@
#ifdef ENABLE_AUTO_DETECT_HSE
uint8_t autoDetectedPllMValue;
static void useHsi() {
// clear SW to use HSI
RCC->CFGR &= ~RCC_CFGR_SW;
@ -122,9 +124,9 @@ extern "C" void __late_init() {
// The external clocks's frequency is the ratio of the measured LSI speed, times HSI's speed (16MHz)
float hseFrequencyMhz = 16.0f * hseCounts / hsiCounts;
uint8_t pllMValue = efiRound(hseFrequencyMhz, 1);
autoDetectedPllMValue = efiRound(hseFrequencyMhz, 1);
reprogramPll(pllMValue);
reprogramPll(autoDetectedPllMValue);
}
#endif // defined ENABLE_AUTO_DETECT_HSE