Go Down

Topic: STM32F411 Clock Speed (Read 421 times) previous topic - next topic

JLLL

I am trying to program my STM32F411 with Arduino IDE.

I can make delay of 1s with this code, so what is my MCU clock speed?

Code: [Select]
void delayCycle(  )
{
 uint32_t cc = 20000000;
 while ( cc-- ){
   __asm( "nop" );
 }
}

Idahowalker

Your clock speed is equal to entering into your favorite search engine the words "STM32F411 clock speed."

Why use a noop when a delay or millis() or, with freeRTOS a vTaskDelay( ), a god choice, or vTaskDelayUntill( ), the best choice would work with the STM32F411?

vTaskDelay and vTaskDelayUntill will give delays without stopping other code from running, under freeRTOS.

TFTLCDCyg

Inside the core oficial of STM or with generic core's like te core of danieleff, you can get the clock speed in MHz whit this:

Code: [Select]
F_CPU/1000000

For example Core7XXI (F746IG)= 216 MHz, in this case with some overclock: 256 MHz


FantomT

Try this:
Code: [Select]
  Serial.print(F("\n\tSys_clock: "));
  Serial.print((uint32_t) SystemCoreClock, DEC);
   

JLLL

Thanks guys.

I try to do this and the MCU delay for exactly 2 sec.

Meaning that the while loop itself take 5 clock cycles, i thought it just take 1 clock cycle.

Code: [Select]
void delayCycle(  )
{
 uint32_t cc = 20000000;
 while ( cc-- ){
   __asm( "nop" );

   __asm( "nop" );
   __asm( "nop" );
   __asm( "nop" );
   __asm( "nop" );
   __asm( "nop" );

 }
}

westfw

No ARM chip will loop in 1 cycle, afaik.  There's always a delay while the instruction pipeline refills.
Also, faster chips will tend to have wait states inserted when accessing flash memory (usually with a poor degree of predictability, due to cache and/or other "accelerators"....

Go Up