2020-08-26 06:03 AM
I'm using freertos on stm32f407vg Discovery board. I'm running system at 150MHz.
I want to calculate time taken by a task for that below is the code snippet.
TickType_t initial_time = 0, end_time = 0,diff = 0;
initial_time = xTaskGetTickCount();
while(1)
{
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_12, GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_SET);
vTaskDelay(1000);
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_12, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_RESET);
end_time= xTaskGetTickCount();
diff = end_time - initial_time;
}
I'm getting difference value = 1000 , which is the value of delay. So should I understand that freertos don't count time taken by a other instructions or I'm missing something. Please clarify.
Solved! Go to Solution.
2020-08-26 07:52 AM
Ticks are in increments of 1ms. Likely the other code is executing in way less than 1ms and so doesn't make an impact.
2020-08-26 07:52 AM
Ticks are in increments of 1ms. Likely the other code is executing in way less than 1ms and so doesn't make an impact.
2020-08-26 09:41 PM
Thanks, Probably this could be the reason.