When I try to the code below, program running very well. But when I enable PLL_ON bit, the program does not work.
Code that works:
void SysClockConfig()
{
RCC->CR = 0x00010000; // HSE ON
while(!(RCC->CR & 0x00020000)); // HSE READY
RCC->CR |= 0x00080000; // CSS ON
RCC->PLLCFGR |= 0x04402D04; // P Q N M SETTINGS
RCC->CFGR |= 0x0009402; // APB SETTINGS
RCC->CIR = 0x00880000;
RCC->AHB1ENR |= 0x000007FF; // GPIOs ARE ENABLE
}
void GPIO_Config()
{
GPIOG->MODER = 0x14000000; // GPIOG 13-14 ARE OUTPUT
GPIOA->MODER = 0x00000000; // GPIOA IS INPUT
GPIOG->OTYPER = 0x00000000; // PUSH-PULL
GPIOG->OSPEEDR = 0x3C000000; // HIGH-SPEED OUTPUT
GPIOG->PUPDR = 0x14000000; // PULL-DOWN
}
Code that does not work:
void SysClockConfig()
{
RCC->CR = 0x00010000; // HSE ON
while(!(RCC->CR & 0x00020000)); // HSE READY
RCC->CR |= 0x00080000; // CSS ON
RCC->PLLCFGR |= 0x04402D04; // P Q N M SETTINGS
RCC->CR |= RCC_CR_PLLON; // MAIN PLL ON
while((RCC->CR & RCC_CR_PLLRDY) != RCC_CR_PLLRDY); // MAIN PLL LOCKED
RCC->CFGR &= ~RCC_CFGR_SW;
RCC->CFGR |= RCC_CFGR_SW_PLL;
while((RCC->CFGR & RCC_CFGR_SW_PLL) != RCC_CFGR_SW_PLL);
RCC->CFGR |= 0x0009402; // APB SETTINGS
RCC->CIR = 0x00880000;
RCC->AHB1ENR |= 0x000007FF; // GPIOs ARE ENABLE
}
void GPIO_Config()
{
GPIOG->MODER = 0x14000000; // GPIOG 13-14 ARE OUTPUT
GPIOA->MODER = 0x00000000; // GPIOA IS INPUT
GPIOG->OTYPER = 0x00000000; // PUSH-PULL
GPIOG->OSPEEDR = 0x3C000000; // HIGH-SPEED OUTPUT
GPIOG->PUPDR = 0x14000000; // PULL-DOWN
}