This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

changing Clock and PLL setting

Hello....
I was using keil 5 that I installed it last year.This year, after refreshing my windows, I had to install keil 5 again, but this time, I have a problem with new version of system_stm32f4xx.c (19-June-2014), and I don't know how to change system clock, I want to use PLL and like to have 168 MHz(I know that my clock is equal to HSI,16MHz)!
Could you please help me?

Thanks in advance

Parents
  • Thanks a lot for your kind help, I'm not familiar with the way you are using, I work directly with the register as follows:

    //##############################################################################
                                    //1//Don't know how to change oscillator type to HSI
    RCC->CR |= 0x00000001;          //2//HSI oscillator ON
    RCC->CR |= 0x01000000;          //3//PLL ON
    RCC->PLLCFGR |= 0x00400000;     //4//Select HSI as PLL source
    RCC->PLLCFGR |= 0x00004810;     //5//adjusting PLL parameters M N P Q for 168MHz (PLL sys clock)
    RCC->CFGR |= 0x00000002;        //6//Select PLL as clock sourse
    RCC->CFGR |= 0x00009400;        //7//Prescaler for AHB(HCLK)-APB1(PCLK1)-APB2(PCLK2)
    //AHB  BUS  is adjusted by Bits 07:04 and its value is 0xxx that means no division from SYSCLK;
    //APB1 BUS  is adjusted by Bits 12:10 and its value is  101 that means division AHB by 4;
    //APB2 BUS  is adjusted by Bits 15:13 and its value is  100 that means division AHB by 2;
    //###########################################################################################
    


    I wrote my code in similar approach as your code(1 to 7). didn't work!
    Is my procedure correct?
    Do I need to change any register before others?!
    Or is there any other register?!

    My Discovery board do nothing! seems to be locked because of special setting I have done blow.

    thanks again

Reply
  • Thanks a lot for your kind help, I'm not familiar with the way you are using, I work directly with the register as follows:

    //##############################################################################
                                    //1//Don't know how to change oscillator type to HSI
    RCC->CR |= 0x00000001;          //2//HSI oscillator ON
    RCC->CR |= 0x01000000;          //3//PLL ON
    RCC->PLLCFGR |= 0x00400000;     //4//Select HSI as PLL source
    RCC->PLLCFGR |= 0x00004810;     //5//adjusting PLL parameters M N P Q for 168MHz (PLL sys clock)
    RCC->CFGR |= 0x00000002;        //6//Select PLL as clock sourse
    RCC->CFGR |= 0x00009400;        //7//Prescaler for AHB(HCLK)-APB1(PCLK1)-APB2(PCLK2)
    //AHB  BUS  is adjusted by Bits 07:04 and its value is 0xxx that means no division from SYSCLK;
    //APB1 BUS  is adjusted by Bits 12:10 and its value is  101 that means division AHB by 4;
    //APB2 BUS  is adjusted by Bits 15:13 and its value is  100 that means division AHB by 2;
    //###########################################################################################
    


    I wrote my code in similar approach as your code(1 to 7). didn't work!
    Is my procedure correct?
    Do I need to change any register before others?!
    Or is there any other register?!

    My Discovery board do nothing! seems to be locked because of special setting I have done blow.

    thanks again

Children