2019-12-09 03:20 AM
------------------------------------------------------------------
The init of RCC was correct. The SystemCoreClock variable dont reflect the new frecuency changes still "SystemCoreClockUpdate" is called.
------------------------------------------------------------------
Hi all,
I'm triyng to initialice the clock using CMSIS, but it dosnt work.
I want to init RCC wirh HSI at 32MHz. If I do it from CUBE, and then read "SystemCoreClok" it says 32000000. But if I do it with CMSIS, "SystemCoreClock" always return 8000000.
I checked the registers value, and they are identical in booth methodes.
Any advice?
This is my code:
RCC->CR |= RCC_CR_HSION;
while(!(RCC->CR & RCC_CR_HSIRDY));
RCC->CR &= ~RCC_CR_PLLON; //Stop PLL
while(RCC->CR & RCC_CR_PLLRDY); //Wait until stop
RCC->CFGR &= ~RCC_CFGR_PLLSRC; //PLL Source (16) 0 HSI
RCC->CFGR &= ~RCC_CFGR_PLLMUL;
RCC->CFGR |= RCC_CFGR_PLLMUL_2 | RCC_CFGR_PLLMUL_1; //PLLMUL x8
RCC->CR |= RCC_CR_PLLON;
while(!(RCC->CR & RCC_CR_PLLRDY));
RCC->CFGR &= ~RCC_CFGR_SW;
RCC->CFGR |= RCC_CFGR_SW_PLL;
frec = SystemCoreClock;