The question about timer task.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

The question about timer task.

618 Views
小勇邹
Contributor II

I create a timer task. I want it to run per 10ms.

The source code.

_timer_create_component(2U,
2000U);

_time_init_ticks(&dticks,
0U);

_time_add_msec_to_ticks(&dticks,
10U);

on_timer =
_timer_start_periodic_at_ticks(IO_BUS_cycle_task, 0, TIMER_ELAPSED_TIME_MODE,
&dticks, &dticks);

But I find that the timer
task runs per 80ms.It does not runs per 10ms.

Is there any error in my
source code?

Also I want to delay 300us.

The source code.

       MQX_TICK_STRUCT dticks;

       _time_init_ticks(&dticks, 0U);  

       _time_add_usec_to_ticks(&dticks, (unsigned int)300);

       _time_delay_for(&dticks);/*It will block the task untill
time out*/

But I find that the timer delay is 5ms.

My hardware is Freescale_MQX_4_1_TWRK64F120M.

0 Kudos
1 Reply

294 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Robin,

Please take a look to the thread below, I am not using tmer task but I configured PIT and reached 1uS interrupt. Please note that you can let MQX handle the interrupts or bypass MQX, to reach 1uS I had to bypass MQX. In the project there is a macro to set if you want MQX to handle interrupts or bypass MQX.

https://community.freescale.com/thread/324484

Hope this helps.

regards,

Carlos

0 Kudos