Skip to content

Commit

Permalink
Turn on MSIPLL even if MSI was already enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
GrumpyOldPizza committed Oct 17, 2016
1 parent 43b8619 commit 5c86d88
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
Binary file modified system/libstm32l4/libstm32l4.a
Binary file not shown.
33 changes: 18 additions & 15 deletions system/libstm32l4/stm32l4_system.c
Original file line number Diff line number Diff line change
Expand Up @@ -905,19 +905,19 @@ bool stm32l4_system_configure(uint32_t hclk, uint32_t pclk1, uint32_t pclk2)
while (!(RCC->CR & RCC_CR_MSIRDY))
{
}

if (stm32l4_system_device.lseclk == 32768)
{
/* Enable the MSI PLL */
RCC->CR |= RCC_CR_MSIPLLEN;
}
}
else
{
RCC->CR = (RCC->CR & ~RCC_CR_MSIRANGE) | msirange | RCC_CR_MSIRGSEL;

armv7m_clock_spin(500);
}

if (stm32l4_system_device.lseclk == 32768)
{
/* Enable the MSI PLL */
RCC->CR |= RCC_CR_MSIPLLEN;
}

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

Expand Down Expand Up @@ -996,19 +996,19 @@ bool stm32l4_system_configure(uint32_t hclk, uint32_t pclk1, uint32_t pclk2)
while (!(RCC->CR & RCC_CR_MSIRDY))
{
}

if (stm32l4_system_device.lseclk == 32768)
{
/* Enable the MSI PLL */
RCC->CR |= RCC_CR_MSIPLLEN;
}
}
else
{
RCC->CR = (RCC->CR & ~RCC_CR_MSIRANGE) | RCC_CR_MSIRANGE_11 | RCC_CR_MSIRGSEL;

armv7m_clock_spin(500);
}

if (stm32l4_system_device.lseclk == 32768)
{
/* Enable the MSI PLL */
RCC->CR |= RCC_CR_MSIPLLEN;
}
}
}
else
Expand Down Expand Up @@ -1153,16 +1153,19 @@ bool stm32l4_system_clk48_enable(void)
while (!(RCC->CR & RCC_CR_MSIRDY))
{
}

/* Enable the MSI PLL */
RCC->CR |= RCC_CR_MSIPLLEN;
}
else
{
RCC->CR = (RCC->CR & ~RCC_CR_MSIRANGE) | RCC_CR_MSIRANGE_11 | RCC_CR_MSIRGSEL;

armv7m_clock_spin(500);
}

if (stm32l4_system_device.lseclk == 32768)
{
/* Enable the MSI PLL */
RCC->CR |= RCC_CR_MSIPLLEN;
}
}
}

Expand Down

0 comments on commit 5c86d88

Please sign in to comment.