stm32l476disco: Fix system clock setup

Code suggested that PLL with MSI is used resulting in 80MHz clock.
When in fact PLL was not configured and system clock was left at MSI 48MHz.

This happens because PLL configuration requires that SysTick interrupt
has interrupt priority level configured correctly.
As it seems ST code intentionally setups variable uwTickPrio to invalid
value and later when it is not setup by user code configuration
of oscillator will fail before PLL is configured.

This simple changes systick priority to some valid value that
allows clock to use PLL.
This commit is contained in:
Jerzy Kasenberg 2020-05-06 14:34:40 +02:00
parent d9e534f6f2
commit 615369a6eb
1 changed files with 4 additions and 0 deletions

View File

@ -95,6 +95,10 @@ static void SystemClock_Config(void)
/* Enable the CSS interrupt in case LSE signal is corrupted or not present */
HAL_RCCEx_DisableLSECSS();
/* Set tick interrupt priority, default HAL value is intentionally invalid
and that prevents PLL initialization in HAL_RCC_OscConfig() */
HAL_InitTick((1UL << __NVIC_PRIO_BITS) - 1UL);
/* Enable MSI Oscillator and activate PLL with MSI as source */
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_MSI;
RCC_OscInitStruct.MSIState = RCC_MSI_ON;