I seem to lack some understanding of the ticks in an ESP system with FreeRTOS integrated.
I created a task in FreeRTOS and in that task I call the following code as an test-example:
Code: Select all
xLastWakeTime = xTaskGetTickCount();
while(counter < 10)
{
if(gpio_state != 0)
{
gpio_state = 0;
}
else
{
gpio_state = 1;
}
gpio_set_level(PIN_RESET_SAFETY_UC, gpio_state);
ESP_LOGI("TEST_LOGGING", "This is round %d at tick %d Here comes just stuff X",counter, (int)xLastWakeTime);
counter++;
vTaskDelayUntil(&xLastWakeTime, 10);
}
I (12572) TEST_LOGGING: This is round 0 at tick 12258 Here comes just stuff
I (12582) TEST_LOGGING: This is round 1 at tick 12268 Here comes just stuff
I (12601) TEST_LOGGING: This is round 2 at tick 12278 Here comes just stuff
I (12620) TEST_LOGGING: This is round 3 at tick 12288 Here comes just stuff
I (12640) TEST_LOGGING: This is round 4 at tick 12298 Here comes just stuff
I (12660) TEST_LOGGING: This is round 5 at tick 12308 Here comes just stuff
I (12680) TEST_LOGGING: This is round 6 at tick 12318 Here comes just stuff
I (12700) TEST_LOGGING: This is round 7 at tick 12328 Here comes just stuff
I (12720) TEST_LOGGING: This is round 8 at tick 12338 Here comes just stuff
I (12740) TEST_LOGGING: This is round 9 at tick 12348 Here comes just stuff
Actually, I would assume that the tick time for the RTOS maches the time from the LOG Timestamp. At least that the difference between both times are matching. Do I understand here something wrong, or did I somewhere mess up with the FreeRTOS integration?
PS: FreeRTOS is configured to run at 1000 Hz --> I Tick 1ms