OsIf counter issue

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

OsIf counter issue

1,374件の閲覧回数
zp001
Contributor III

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.

0 件の賞賛
返信
1 返信

1,353件の閲覧回数
VaneB
NXP TechSupport
NXP TechSupport

Hi @zp001 

You mentioned that the values of cur_time and elapsed time are not regular, is there too much of a difference between each value? Could you share some values you got?
Also, may I know if you have more tasks?
Did you try any sample code? If the answer is yes, did you see any similar behavior?

One last thing, which MCU are you using?

It would be helpful if you could provide me with this information.

 

B.R.

VaneB

0 件の賞賛
返信