Question
Cannot switch to PLL1
Hello,
I am trying to switch system clock on H743ZI to PPL1. Using following code, it hangs up on checking SWS flag - clock switch begins, but never ends.
I have tried setting domain prescalers before or after clock switch. The same for flash latency.
I can switch to HSE, but not to PLL. I have checked PLL status, PLLRDY is asserted.
What am I doing wrong?
PWR->CR3 |= PWR_CR3_SCUEN;
PWR->CR3 |= PWR_CR3_LDOEN;
PWR->D3CR |= PWR_D3CR_VOS;
while ((PWR->D3CR & PWR_D3CR_VOSRDY) != PWR_D3CR_VOSRDY) ;
FLASH->ACR |= FLASH_ACR_LATENCY_5WS;
RCC->CR |= RCC_CR_HSEON;
while ((RCC->CR & RCC_CR_HSERDY) != RCC_CR_HSERDY);
RCC->PLLCKSELR |= RCC_PLLCKSELR_PLLSRC_HSE;
RCC->PLLCKSELR |= RCC_PLLCKSELR_DIVM1_2; // DIVM1 /4
RCC->PLLCFGR &= ~RCC_PLLCFGR_DIVQ1EN;
RCC->PLLCFGR &= ~RCC_PLLCFGR_DIVR1EN;
RCC->PLLCFGR |= RCC_PLLCFGR_PLL1RGE_2;
RCC->PLL1DIVR |= 1 << RCC_PLL1DIVR_P1_Pos; //DIVP /2
RCC->PLL1DIVR |= (0x7FUL) << RCC_PLL1DIVR_N1_Pos; // DIVN1 x128
RCC->CR |= RCC_CR_PLL1ON;
while ((RCC->CR & RCC_CR_PLL1RDY) != RCC_CR_PLL1RDY) ;
RCC->CFGR |= RCC_CFGR_SW_PLL1;
while ((RCC->CFGR & RCC_CFGR_SWS_Msk) != RCC_CFGR_SWS_PLL1) ;
RCC->D1CFGR |= RCC_D1CFGR_HPRE_3;
RCC->D1CFGR |= RCC_D1CFGR_D1PPRE_2;
RCC->D2CFGR |= RCC_D2CFGR_D2PPRE1_2;
RCC->D2CFGR |= RCC_D2CFGR_D2PPRE2_2;
RCC->D3CFGR |= RCC_D3CFGR_D3PPRE_2;Thanks in advance,
Stanislav
