FRDM-K22F execution time vs. clock frequency

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

FRDM-K22F execution time vs. clock frequency

1,145件の閲覧回数
Stachu
Contributor I

Hi,

I want to turn on the RGB LEDs after some time delay. Here is a code (KDS 3.2.0):

void LED_ON()
{
uint16_t i, n;
for(i=0;i<3000;i++)
{
for(n=0;n<9000;n++)
{
__asm("nop");
}
}
Bit1_ClrVal();
Bit2_ClrVal();
Bit3_ClrVal();
}


int main(void)
{
PE_low_level_init();
#ifdef PEX_RTOS_START
PEX_RTOS_START();
#endif
LED_ON();
for(;;){}
}

First I set clocks to the maximum possible values :Core clock=120MHz, Bus clock=60MHz, Flash clock=24MHz. Now I generate Processor Expert code and then compile the project. No warnings, no errors. Then Run=>Flash from file. Works fine. Double loop delay in LED_ON function takes 14 seconds before LEDs turn ON. Now I set clocks to a minimum possible frequencies: Core clock=8MHz, Bus clock=8MHz, Flash clock=8MHz. Again, Processor Expert code generation, compilation and Flashing.

And again it works fine, however, the double loop delay is exactly the same, i.e. 14 seconds. I was expecting a longer time. How to explain it?

RGDS, Stachu

 

0 件の賞賛
返信
4 返答(返信)

1,105件の閲覧回数
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Stachu,

Maybe attach your project directly so we can find the problem faster. 

Best Regards,
Robin

0 件の賞賛
返信

1,128件の閲覧回数
ErichStyger
Specialist I

What is the value of your CPU_CORE_CLK_HZ?

I could use the debugger to step through the clock initialization to verify it is really doing what you think it is doing.

Erich

0 件の賞賛
返信

1,106件の閲覧回数
Stachu
Contributor I

Unfortunately I have no idea what is the value of CPU_CORE_CLK_HZ. I have inspected CXPI_Config.h file and found several clock configurations defined. But which one is choosen, I don't know. Anyway, I would appreciate if you can do me a favour and check how it works.

RGDS, Stachu

0 件の賞賛
返信

1,099件の閲覧回数
ErichStyger
Specialist I

Hi @Stachu ,

I recommend that you step through your PE_low_level_init(); and check what it is doing.

It sets up the clocking, so you should see there what values it is using.

 

I hope this helps,

Erich

0 件の賞賛
返信