Turn off HSI earlier

This commit is contained in:
Alexander Heldt
2024-12-30 11:47:54 +01:00
parent 88dcd47552
commit f44ddf645b

View File

@@ -17,6 +17,9 @@ static void system_clock_init(void) {
PWR->CR &= ~(PWR_CR_VOS_MASK << PWR_CR_VOS_BIT);
PWR->CR |= (PWR_SCALE3 << PWR_CR_VOS_BIT);
// Turn off HSI (which is on by default)
RCC->CR &= ~RCC_CR_HSION_ON;
// Turn on HSE
RCC->CR |= RCC_CR_HSEON_ON;
@@ -68,9 +71,6 @@ static void system_clock_init(void) {
// Wait indefinitely for PLL clock to be selected
// TODO indicate error/timeout somehow?
while (((RCC->CFGR >> RCC_CFGR_SWS_BIT) & RCC_CFGR_SWS_MASK) != RCC_CFGR_SWS_PLL);
// Turn off HSI (which is on by default)
RCC->CR &= ~RCC_CR_HSION_ON;
}
int main(void) {