Porting STM32L432 to STM32L496: HSE Never Goes Ready?
As above, have a project I'm porting from one custom board to another. Using the same external crystal (8Mhz) and virtually identical circuitry with the exception of a few custom ASICs. This code works fine on the L432, but when I run it on the L496 (debugging via STLink pod) I get a timeout while waiting for HSE to go ready.
/* Enable HSE BYPASS to PLL */
RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
/* Initialization Error */
ClockError();
}This is directly from the ST LIbrary file stm32l4xx_hal_rcc.c; I hit this timeout every time waiting on HSE. Brought the timeout value from 100mS default to 500mS, no change.
/* Set the new HSE configuration ---------------------------------------*/
__HAL_RCC_HSE_CONFIG(RCC_OscInitStruct->HSEState);
/* Check the HSE State */
if(RCC_OscInitStruct->HSEState != RCC_HSE_OFF)
{
/* Get Start Tick*/
tickstart = HAL_GetTick();
/* Wait till HSE is ready */
while(READ_BIT(RCC->CR, RCC_CR_HSERDY) == RESET)
{
if((HAL_GetTick() - tickstart) > HSE_TIMEOUT_VALUE)
{
return HAL_TIMEOUT; //Times out at 200mS (default was 100mS)
}
}
}