Skip to main content
danielturcanu
Associate
December 10, 2013
Question

How to measure speed of STM32F429

  • December 10, 2013
  • 2 replies
  • 660 views
Posted on December 10, 2013 at 06:34

I have a STM32429I-EVAL board, initialized it and made it work, but I am not sure if the processor speed is up to max. The function RCC_GetClocksFreq returns 180 MHz, but cannot trust its return.

I did a loop to toggle LED1 and the max speed of toggle is 4 MHz.

while(1)

{

  STM_EVAL_LEDToggle(LED1);

}

This 4 MHz seems too low to me, I don't think the processor spends 45 cycles to toggle the led.

Is there a more precise way to measure the speed?
    This topic has been closed for replies.

    2 replies

    Tesla DeLorean
    Guru
    December 10, 2013
    Posted on December 10, 2013 at 06:56

    Use a TIMx_CHx pin of known ratio, or one of the MCOx pins?

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    francescatodiego
    Associate III
    December 10, 2013
    Posted on December 10, 2013 at 09:48

    RCC_GetClocksFreq header note:

     * @note   The system frequency computed by this function is not the real

      *         frequency in the chip. It is calculated based on the predefined

      *         constant and the selected clock source:

    You must define the correct HSE_VALUE (if external clock is used)

    Add the compiler symblo define

    HSE_VALUE=*clockvalue*

    Example for 8MHz clock

    HSE_VALUE= (8000000)

    Check also PLL_M and PLL_N constants in system_stm32f4xx.c file

    Default value for PLL_M and PLL_Nobtain max HCLK frrequency but with HSE_VALUE = 25MHz

    You must change PLL_M and PLL_N values to obtain correct PLL frequency (must be between 190...400MHz)

    HCLK is PLL freq/PLL_P value PLL_P minimum value 2 --> HCLK max value is half of PLL frequency