Problem with SystemClock_Config() causing HardFault_Handler() when using code from new version of CubeMX Ver 5.5.0
STM32L011F4
I have upgraded CubeMX and the latest firmware does not run on some hardware boards that were OK with older firmware. I have tracked it down to the SystemClock_Config() failing and causing a HardFault_Handler() The latest HAL version has timeouts defined in stm32l0xx_hal_rcc.h as
#define MSI_TIMEOUT_VALUE (2U) /* 2 ms (minimum Tick + 1) */
#define HSI_TIMEOUT_VALUE (2U) /* 2 ms (minimum Tick + 1) */
#define LSI_TIMEOUT_VALUE (2U) /* 2 ms (minimum Tick + 1) */
#define PLL_TIMEOUT_VALUE (2U) /* 2 ms (minimum Tick + 1) */
I'm using the 16MHz HSI and PLL set for x3 div 3 for an output of 16MHz and all clocks set for 16MHz. VCC is 3.3 Volt, 4 layer PCB and supply clean etc.
If I increase the timeout #defines to 100mS, all boards work OK with no problems. I cannot find any information on how long the PLL takes to stabilise but 1mS +1 seems to be too short on some of my PCBs.
Timeout values of 4mS work on all PCBs but 2mS does not. I've set it to 100mS as the actual value isn't important if the oscillators and PLL start up OK.
Could someone please check if my findings are correct or if I still have a hardware problem that I am masking with the long timeout values.
Thanks Stephen Wright