Skip to content

Commit 5c86d88

Browse files
Turn on MSIPLL even if MSI was already enabled
1 parent 43b8619 commit 5c86d88

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

system/libstm32l4/libstm32l4.a

8 Bytes
Binary file not shown.

system/libstm32l4/stm32l4_system.c

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -905,19 +905,19 @@ bool stm32l4_system_configure(uint32_t hclk, uint32_t pclk1, uint32_t pclk2)
905905
while (!(RCC->CR & RCC_CR_MSIRDY))
906906
{
907907
}
908-
909-
if (stm32l4_system_device.lseclk == 32768)
910-
{
911-
/* Enable the MSI PLL */
912-
RCC->CR |= RCC_CR_MSIPLLEN;
913-
}
914908
}
915909
else
916910
{
917911
RCC->CR = (RCC->CR & ~RCC_CR_MSIRANGE) | msirange | RCC_CR_MSIRGSEL;
918912

919913
armv7m_clock_spin(500);
920914
}
915+
916+
if (stm32l4_system_device.lseclk == 32768)
917+
{
918+
/* Enable the MSI PLL */
919+
RCC->CR |= RCC_CR_MSIPLLEN;
920+
}
921921

922922
RCC->CFGR = (RCC->CFGR & ~RCC_CFGR_SW) | RCC_CFGR_SW_MSI;
923923

@@ -996,19 +996,19 @@ bool stm32l4_system_configure(uint32_t hclk, uint32_t pclk1, uint32_t pclk2)
996996
while (!(RCC->CR & RCC_CR_MSIRDY))
997997
{
998998
}
999-
1000-
if (stm32l4_system_device.lseclk == 32768)
1001-
{
1002-
/* Enable the MSI PLL */
1003-
RCC->CR |= RCC_CR_MSIPLLEN;
1004-
}
1005999
}
10061000
else
10071001
{
10081002
RCC->CR = (RCC->CR & ~RCC_CR_MSIRANGE) | RCC_CR_MSIRANGE_11 | RCC_CR_MSIRGSEL;
10091003

10101004
armv7m_clock_spin(500);
10111005
}
1006+
1007+
if (stm32l4_system_device.lseclk == 32768)
1008+
{
1009+
/* Enable the MSI PLL */
1010+
RCC->CR |= RCC_CR_MSIPLLEN;
1011+
}
10121012
}
10131013
}
10141014
else
@@ -1153,16 +1153,19 @@ bool stm32l4_system_clk48_enable(void)
11531153
while (!(RCC->CR & RCC_CR_MSIRDY))
11541154
{
11551155
}
1156-
1157-
/* Enable the MSI PLL */
1158-
RCC->CR |= RCC_CR_MSIPLLEN;
11591156
}
11601157
else
11611158
{
11621159
RCC->CR = (RCC->CR & ~RCC_CR_MSIRANGE) | RCC_CR_MSIRANGE_11 | RCC_CR_MSIRGSEL;
11631160

11641161
armv7m_clock_spin(500);
11651162
}
1163+
1164+
if (stm32l4_system_device.lseclk == 32768)
1165+
{
1166+
/* Enable the MSI PLL */
1167+
RCC->CR |= RCC_CR_MSIPLLEN;
1168+
}
11661169
}
11671170
}
11681171

0 commit comments

Comments
 (0)