-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Description
I've been asked to check the operation of the 32 kHz LSE crystal on our board. What we've done is similar/identical to the NUCLEO_L433RC_P.
I believe our LSE is functioning correctly but I'm trying to understand if the device configuration would fail if it wasn't.
SetSysClock_PLL_MSI
in targets\TARGET_STM\TARGET_STM32L4\TARGET_STM32L433xC\TARGET_NUCLEO_L433RC_P\system_clock.c
enables the LSE and configures the PLL.
AFAICT, no error will occur if the LSE does not become ready:
// Enable LSE Oscillator to automatically calibrate the MSI clock
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; // No PLL update
RCC_OscInitStruct.LSEState = RCC_LSE_ON; // External 32.768 kHz clock on OSC_IN/OSC_OUT
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) == HAL_OK) {
RCC->CR |= RCC_CR_MSIPLLEN; // Enable MSI PLL-mode
}
I'm wondering why it doesn't fail if HAL_RCC_OscConfig
fails as happens with the other calls to HAL_RCC_OscConfig
?
Also, I don't understand why RCC->CR |= RCC_CR_MSIPLLEN
is effectively repeated with a call to HAL_RCCEx_EnableMSIPLLMode
after the configuration of the PLL? The first enable is dependant on the successful configuration of LSE and the second is unconditional.
Issue request type
[X] Question
[ ] Enhancement
[ ] Bug