Hello NXP team,
static void my_task(void *para)
{
(void)para;
static uint32_t cur_time = 0;
static uint32_t prev_time = 0;
static uint32_t cur_tick = 0;
static uint32_t prev_tick = 0;
static uint32_t start_time = 0;
static uint32_t elapsed_time = 0;
while(1)
{
start_time = OsIf_GetCounter(OSIF_COUNTER_SYSTEM);
printf("start_time %ld\r\n", start_time);
vTaskDelayUntil( &xLastWakeTime, 100/ portTICK_PERIOD_MS);
elapsed_time = OsIf_GetElapsed(&start_time, OSIF_COUNTER_SYSTEM);
printf("elapsed_time %ld deta time = %ld\r\n", elapsed_time, elapsed_time - start_time);
prev_time = cur_time;
cur_time = OsIf_GetCounter(OSIF_COUNTER_SYSTEM);
printf("current time %ld prev_time %ld cur_tick %ld prev_tick %ld \r\n", cur_time, prev_time, cur_tick, prev_tick);
printf("current time %ld\r\n", cur_time);
}
}
my_task is scheduled about every 100ms,the question is the values of cur_time and elapsed time are not regular.
I'd like to know how to get system tick.