Some parameters in Freertos_config_file.h

Hello everyone,

Actually I start using Freertos as kernel for my Nucleo-stm32f103rb board. but I have some misunderstanding about the relationship between some parameters: configCPU_CLOCK_HZ, configTICK_RATE_HZ and peripheral timer. In my project in order to blink my LED each 1s (1s OFF and 1s ON), I use 36MHZ for my clock_CPU and Timer2 that generate signal every 1s. So in order to my project works well i must put 10 in configTICK_RATE_HZ. if I change it there will be no blinking. Pls somene could highlight me about that ? the relationship between these 3 parameters?

Are you generating the tick interrupt from the Cortex-M’s internal SysTick clock? That is the default for Cortex-M, but I believe that clock is also used by the ST HAL so often ST users will instead generate the tick interrupt from a peripheral clock.

If you are using the default behaviour then configCPU_CLOCK_HZ should be set to 36MHz (36000000), and configTICK_RATE_HZ should be set to the frequency at which you want the tick interrupt to execute. It is common to use a 1KHz (1000) tick in our demos, partly the test the FreeRTOS port, and partly to keep the maths easy, but most real application will use a lower tick rate.

Once you do that, check the tick is executing at the rate you expect. That can be done using an LED, or a scope, or some other method. Then, if you want an event to occur at, say, 100ms intervals, use pdMS_TO_TICKS( 100 ) to specify the time interval. For example, vTaskDelay( pdMS_TO_TICKS( 100 ) );