Skip to main content
filippo2991
Associate III
April 27, 2010
Question

SystemFrequency takes the right core clock frequency?

  • April 27, 2010
  • 3 replies
  • 806 views
Posted on April 27, 2010 at 15:22

SystemFrequency takes the right core clock frequency?

    This topic has been closed for replies.

    3 replies

    filippo2991
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:48

    I'm using IAR, as far as I know I can add global defines as I would write

    #define MYDEFINE

    but not

    #define MYDEFINE 0

    Anyway, HSE_Value   is se to the correct value (8M) but I get 72M as SystemFrequency. Am I running at that core frequency?

    Nickname12657_O
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:48

    Hi,

    You have just to update HSE_Value in your Toolchain preprocessor,  by default it is defined in File \Libraries\CMSIS\Core\CM3\stm32f10x.h :

    /**

     * @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 */

    SystemFrequency   is computing the Frequency based on this ''Value''. Hope it helps you.

    Cheers,

    STOne-32.
    filippo2991
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:48

    probably I am missing something, but that HSE_Value is correctly set. If I printout its value it shows 8000000; that's the correct value for my HSE clock, yet the SystemFrequency shows 72000000 whether I am running at 36 or 8 MHz