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
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
In principal you can work that way. However this will be hard.
I suggest that you use an existing example project [such as the CMSIS-RTOS Blinky (STM32F4-Discovery)] and run to main. Then you can see the register values that are written by the SystemClock_Config function and copy these values.
Well, if you choose to work directly with the registers, then you must also accept the responsibility to study and fully understand all those registers, how they work, and and how to use them.
See: http://www.keil.com/forum/59715
Thank you!
the procedure of configuring the register is different you have to configure pllcfgr first and then turn on pll similarly set the ahb and apb prescalar values first and then select the system clock.