Bug in STM32CubeIDE/MX RCC clock config? Generated code trying to init LSE but I don't have an LSE nor is there one configured in the clock tree.
Using an STM32L562Q part: configured the clock tree to use LSI, MSI, and HSI48 internal clocks. Odd that RCC_OscInitStruct.OscillatorType = 0x3C
Code generator is setting RCC_OSCILLATORTYPE_LSE as one of clocks to init but I don't have an external LSE crystal. When main calls the clock config, it executes this code:
/* Set the new LSE configuration -----------------------------------------*/
if ((RCC_OscInitStruct->LSEState & RCC_BDCR_LSEON) != 0U)
{
if ((RCC_OscInitStruct->LSEState & RCC_BDCR_LSEBYP) != 0U)
{
/* LSE oscillator bypass enable */
SET_BIT(RCC->BDCR, RCC_BDCR_LSEBYP);
SET_BIT(RCC->BDCR, RCC_BDCR_LSEON);
}
Code then fails 5 seconds later when the non-existent LSE doesn't come ready:
/* Check the LSE State */
if (RCC_OscInitStruct->LSEState != RCC_LSE_OFF)
{
/* Get Start Tick*/
tickstart = HAL_GetTick();
/* Wait till LSE is ready */
while (READ_BIT(RCC->BDCR, RCC_BDCR_LSERDY) == 0U)
{
if ((HAL_GetTick() - tickstart) > RCC_LSE_TIMEOUT_VALUE)
{
/* New check to avoid false timeout detection in case of preemption */
if (READ_BIT(RCC->BDCR, RCC_BDCR_LSERDY) == 0U)
{
return HAL_TIMEOUT;
