aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
authorRocco Marco Guglielmi <roccomarco.guglielmi@live.com>2016-07-06 14:05:57 +0000
committerRocco Marco Guglielmi <roccomarco.guglielmi@live.com>2016-07-06 14:05:57 +0000
commit53055a4b73bdad4f7c0e8b0bfbe34fdffc70361e (patch)
treecef1f6fe36408e0b4ad1e57a2cea168c17fc9330 /os
parent0ab5ee926b5cc9b162278bd1863c81cfe07cc7dc (diff)
downloadChibiOS-53055a4b73bdad4f7c0e8b0bfbe34fdffc70361e.tar.gz
ChibiOS-53055a4b73bdad4f7c0e8b0bfbe34fdffc70361e.tar.bz2
ChibiOS-53055a4b73bdad4f7c0e8b0bfbe34fdffc70361e.zip
Fixed Bug #763.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9684 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os')
-rw-r--r--os/hal/ports/STM32/STM32L4xx/hal_lld.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/os/hal/ports/STM32/STM32L4xx/hal_lld.c b/os/hal/ports/STM32/STM32L4xx/hal_lld.c
index 4eea068c9..c4916b8af 100644
--- a/os/hal/ports/STM32/STM32L4xx/hal_lld.c
+++ b/os/hal/ports/STM32/STM32L4xx/hal_lld.c
@@ -48,7 +48,7 @@ uint32_t SystemCoreClock = STM32_HCLK;
/**
* @brief Initializes the backup domain.
- * @note WARNING! Changing clock source impossible without resetting
+ * @note WARNING! Changing RTC clock source impossible without resetting
* of the whole BKP domain.
*/
static void hal_lld_backup_domain_init(void) {
@@ -60,6 +60,27 @@ static void hal_lld_backup_domain_init(void) {
RCC->BDCR = 0;
}
+#if STM32_LSE_ENABLED
+ /* LSE activation.*/
+#if defined(STM32_LSE_BYPASS)
+ /* LSE Bypass.*/
+ RCC->BDCR |= STM32_LSEDRV | RCC_BDCR_LSEON | RCC_BDCR_LSEBYP;
+#else
+ /* No LSE Bypass.*/
+ RCC->BDCR |= STM32_LSEDRV | RCC_BDCR_LSEON;
+#endif
+ while ((RCC->BDCR & RCC_BDCR_LSERDY) == 0)
+ ; /* Wait until LSE is stable. */
+#endif
+
+#if STM32_MSIPLL_ENABLED
+ /* MSI PLL activation depends on LSE. Reactivating and checking for
+ MSI stability.*/
+ RCC->CR |= RCC_CR_MSIPLLEN;
+ while ((RCC->CR & RCC_CR_MSIRDY) == 0)
+ ; /* Wait until MSI is stable. */
+#endif
+
#if HAL_USE_RTC
/* If the backup domain hasn't been initialized yet then proceed with
initialization.*/