summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Badertscher <badi@baerospace.ch>2017-09-02 19:46:23 +0200
committerDamien George <damien.p.george@gmail.com>2017-09-04 17:45:08 +1000
commit98da3cf407d51e0a8c321501163de8ba00d6456b (patch)
treee16f2e2e2323576b78e348de69179b2712ef4601
parent689dae1211b4a3a6384a08ec2d7cdf2bb786d53a (diff)
stmhal: Fix clock initialisation of L4 MCUs.
There are 2 changes: - remove early initialisation of LSE and replaced it by LSEDRIVE config (there is no reason to call HAL_RCC_OscConfig twice). - add initialisation of the variables PLLSAI1Source and PLLSAI1M as they are needed in Cube HAL 1.8.1.
-rw-r--r--stmhal/system_stm32.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/stmhal/system_stm32.c b/stmhal/system_stm32.c
index ed843af82..b71a03181 100644
--- a/stmhal/system_stm32.c
+++ b/stmhal/system_stm32.c
@@ -331,12 +331,8 @@ void SystemClock_Config(void)
regarding system frequency refer to product datasheet. */
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
#elif defined(MCU_SERIES_L4)
- /* Enable the LSE Oscillator */
- RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE;
- RCC_OscInitStruct.LSEState = RCC_LSE_ON;
- if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
- __fatal_error("HAL_RCC_OscConfig");
- }
+ // Configure LSE Drive Capability
+ __HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW);
#endif
/* Enable HSE Oscillator and activate PLL with HSE as source */
@@ -464,6 +460,8 @@ void SystemClock_Config(void)
PeriphClkInitStruct.UsbClockSelection = RCC_USBCLKSOURCE_PLLSAI1;
PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
PeriphClkInitStruct.RngClockSelection = RCC_RNGCLKSOURCE_PLLSAI1;
+ PeriphClkInitStruct.PLLSAI1.PLLSAI1Source = RCC_PLLSOURCE_MSI;
+ PeriphClkInitStruct.PLLSAI1.PLLSAI1M = 1;
PeriphClkInitStruct.PLLSAI1.PLLSAI1N = 24;
PeriphClkInitStruct.PLLSAI1.PLLSAI1P = RCC_PLLP_DIV7;
PeriphClkInitStruct.PLLSAI1.PLLSAI1Q = RCC_PLLQ_DIV2;