stm32: Only use the HSI48 clock when doing "usb clock recovery"

The HSI48 clock on the stm32f042 isn't as accurate as the main HSI
clock.  So, only use the HSI48 clock when using USB to synchronize
that clock.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2020-12-08 09:00:47 -05:00
parent 6bbfc869a1
commit 39a04eac5f
1 changed files with 2 additions and 1 deletions

View File

@ -211,7 +211,8 @@ armcm_main(void)
FLASH->ACR = (1 << FLASH_ACR_LATENCY_Pos) | FLASH_ACR_PRFTBE;
// Configure main clock
if (CONFIG_MACH_STM32F042 && CONFIG_STM32_CLOCK_REF_INTERNAL)
if (CONFIG_MACH_STM32F042 && CONFIG_STM32_CLOCK_REF_INTERNAL
&& CONFIG_USBSERIAL)
hsi48_setup();
else
pll_setup();