cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in setting the clock of my device .

samiassaad
Associate II
Posted on March 17, 2011 at 13:40

Problem in setting the clock of my device .

18 REPLIES 18
Posted on May 17, 2011 at 14:28

For 72 MHz from an 8 MHz external

Set the PLL to HSE DIV 1, and MUL 9?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
samiassaad
Associate II
Posted on May 17, 2011 at 14:28

 if(SysTick_Config(SystemCoreClock /3150) )   // 1ms interrupts

 {

 while(1);  // error

 }

when I used this , ;I get correct interrupts every 1ms !

samiassaad
Associate II
Posted on May 17, 2011 at 14:28

I am using the new library ,

I just uncommented the desire lines and I added HSE_VALUE in uv4 under c/c++ .

how can I check  the PLL to HSE DIV 1, and MUL 9?

Thank you Clive

samiassaad
Associate II
Posted on May 17, 2011 at 14:28

Could it be from the system tick settings ? 

if(SysTick_Config(SystemCoreClock / 1000) )   // 1ms interrupts

where it does not set it to 1ms , it set it to 3ms , can it be ? how can I check that . ? anyway ?

Posted on May 17, 2011 at 14:28

 if(SysTick_Config(SystemCoreClock /3150) )   // 1ms interrupts

 

 {

 

 while(1);  // error

 }

 

when I used this , ;I get correct interrupts every 1ms !

 

Dude, this is because your processor is running at 23.04 MHz, not 72 MHz.

25 / 8  = 3.125

3125 would be the ideal value for 1 ms.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on May 17, 2011 at 14:28

From Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h, either modify the HSE_VALUE here, or make sure you use -DHSE_VALUE=8000000 on the compiler command line in the project.

/**

 * @brief In the following line adjust the value of External High Speed oscillator (HSE)

   used in your application

   Tip: To avoid modifying this file each time you need to use different HSE, you

        can define the HSE value in your toolchain compiler preprocessor.

  */

#if !defined  HSE_VALUE

 #ifdef STM32F10X_CL

  #define HSE_VALUE    ((uint32_t)25000000) /*!< Value of the External oscillator in Hz */

 #else

  #define HSE_VALUE    ((uint32_t)8000000) /*!< Value of the External oscillator in Hz */

 #endif /* STM32F10X_CL */

#endif /* HSE_VALUE */

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
samiassaad
Associate II
Posted on May 17, 2011 at 14:28

Could you guide me to work with 72MHZ with the new library ?

what did I did wrong according to the new drivers?

Thank you alot Clive

samiassaad
Associate II
Posted on May 17, 2011 at 14:28

Already I have in uv4 under c/c++ 

USE_STDPERIPH_DRIVER, STM32F10X_CL,HSE_VALUE=8000000

did I forget to set something else ?

Posted on May 17, 2011 at 14:28

Maybe you need to ''Clean'' and ''Rebuild All'' to make sure the library is built with the right frequency.

Or you could edit the file directly, as suggested before.

If your 1ms tick is still 3.125 ms then somewhere in your code/libraries it thinks the source clock is 25 MHz and setting the PLL accordingly.

Run the debugger through the PLL setup code, ie uncheck run-to main() and step through the init code.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..