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
 
					
				
		
 Robin_Shen
		
			Robin_Shen
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi Stachu,
Maybe attach your project directly so we can find the problem faster.
Best Regards,
Robin
 
					
				
		
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
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
 
					
				
		
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
