Changing configCPU_CLOCK_HZ changes delay lengths

richdinoso wrote on Friday, April 07, 2017:

I am working with the EFM32 GG starter kit. I’m testing the blink LED demo that comes with Simplicity Studio. In FreeRTOSConfig.h there is this line:

#define configCPU_CLOCK_HZ                        (( unsigned long ) 14000000)

When I change the value to 24000000 the length of vTaskDelay increases as well. Is there another #define that needs to be changed in conjunction?

configTICK_RATE_HZ is 1000, and the number of ticks being passed to vTaskDelay is correctly calculated.

The task definition and creation:

static void LedBlink(void *pParameters)
  TaskParams_t     * pData = (TaskParams_t*) pParameters;
  const portTickType delay = pData->delay;

  for (;;)
/* Parameters value for taks*/
  static TaskParams_t parametersToTask1 = { pdMS_TO_TICKS(1000), 0 };
  static TaskParams_t parametersToTask2 = { pdMS_TO_TICKS(1000), 1 };

  /*Create two task for blinking leds*/
  xTaskCreate( LedBlink, (const char *) "LedBlink1", STACK_SIZE_FOR_TASK, &parametersToTask1, TASK_PRIORITY, NULL);
  xTaskCreate( LedBlink, (const char *) "LedBlink2", STACK_SIZE_FOR_TASK, &parametersToTask2, TASK_PRIORITY, NULL);

rtel wrote on Friday, April 07, 2017:

Is this using Systick to generate the tick interrupt? Or is it using a
low power clock along with some low power modes?

richdinoso wrote on Friday, April 07, 2017:

This is the function that sets up the tick interrupt.

__attribute__(( weak )) void vPortSetupTimerInterrupt( void )
	/* Calculate the constants required to configure the tick interrupt. */
	#if configUSE_TICKLESS_IDLE == 1
		ulTimerCountsForOneTick = ( configSYSTICK_CLOCK_HZ / configTICK_RATE_HZ );
		xMaximumPossibleSuppressedTicks = portMAX_24_BIT_NUMBER / ulTimerCountsForOneTick;
		ulStoppedTimerCompensation = portMISSED_COUNTS_FACTOR / ( configCPU_CLOCK_HZ / configSYSTICK_CLOCK_HZ );
	#endif /* configUSE_TICKLESS_IDLE */

	/* Configure SysTick to interrupt at the requested rate. */

configSYSTICK_CLOCK_HZ = 14000000, configTICK_RATE_HZ = 1000
ulTimerCountsForOneTick = 14000

rtel wrote on Friday, April 07, 2017:

As you say:

ulTimerCountsForOneTick = 14000

is it right that configUSE_TICKLESS_IDLE is set to 1? If so, could you
try setting it to 0 and see if you observe the same behaviour, or if
that fixes the issue. That will narrow down where we need to look.

richdinoso wrote on Friday, April 07, 2017:

The debugger runs into that code, so configUSE_TICKLESS_IDLE is sure set to 1. I already tried setting it to 0, but I did it again just now to double check. The behavior is the same.

richdinoso wrote on Monday, April 10, 2017:

Someone pointed out that changing this value does not actually change my clock. Sorry for the misunderstanding. Thread closed.