aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms/STM32L1xx/hal_lld.c
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-06-19 10:45:38 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-06-19 10:45:38 +0000
commitec3ca5b4e615639dd3b4650eaa8d5739b78a1cbc (patch)
tree2f0d0c629a962faa0213a1e88e5427993153ee0d /os/hal/platforms/STM32L1xx/hal_lld.c
parente612b8c794623e0fc82b11cf47da4e1b410984f9 (diff)
downloadChibiOS-ec3ca5b4e615639dd3b4650eaa8d5739b78a1cbc.tar.gz
ChibiOS-ec3ca5b4e615639dd3b4650eaa8d5739b78a1cbc.tar.bz2
ChibiOS-ec3ca5b4e615639dd3b4650eaa8d5739b78a1cbc.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3061 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms/STM32L1xx/hal_lld.c')
-rw-r--r--os/hal/platforms/STM32L1xx/hal_lld.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/os/hal/platforms/STM32L1xx/hal_lld.c b/os/hal/platforms/STM32L1xx/hal_lld.c
index 8f6027865..c9d8a3914 100644
--- a/os/hal/platforms/STM32L1xx/hal_lld.c
+++ b/os/hal/platforms/STM32L1xx/hal_lld.c
@@ -59,10 +59,10 @@
void hal_lld_init(void) {
/* Reset of all peripherals.*/
- RCC->APB1RSTR = 0xFFFFFFFF;
- RCC->APB2RSTR = 0xFFFFFFFF;
- RCC->APB1RSTR = 0;
- RCC->APB2RSTR = 0;
+// RCC->APB1RSTR = 0xFFFFFFFF;
+// RCC->APB2RSTR = 0xFFFFFFFF;
+// RCC->APB1RSTR = 0;
+// RCC->APB2RSTR = 0;
/* SysTick initialization using the system clock.*/
SysTick->LOAD = STM32_HCLK / CH_FREQUENCY - 1;
@@ -129,8 +129,12 @@ void stm32_clock_init(void) {
#endif
#if STM32_LSE_ENABLED
- /* LSE activation.*/
- RCC->CSR |= RCC_CSR_LSEON;
+ /* LSE activation, have to unlock the register.*/
+ if ((RCC->CSR & RCC_CSR_LSEON) == 0) {
+ PWR->CR |= PWR_CR_DBP;
+ RCC->CSR |= RCC_CSR_LSEON;
+ PWR->CR &= ~PWR_CR_DBP;
+ }
while ((RCC->CSR & RCC_CSR_LSERDY) == 0)
; /* Waits until LSE is stable. */
#endif