LWtimer not working properly

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

LWtimer not working properly

554 Views
sunilvasudevan
Contributor I

Hi

I am trying to get periodic timer interrupts for specific time interval(1s) .It is found that number of ticks per second is 200.I have created the timer in the following way

_lwtimer_create_periodic_queue(&off_timerPeriodQueue, OffTime+1, 0 );

_lwtimer_add_timer_to_queue( &off_timerPeriodQueue, &off_timer, OffTime, off_timer_isr, NULL );

So accordingly if I give value of Offtime as 200,it should call the ISR after I sec,am I right?But I am not getting the callback.

Can anybody give any suggestions?

----------------------------------------------------------------------------------------------------------------------------------------------

I tried with only one task.. At that time it is accurately working(when I give 200 it waits for 1 sec, when I give 400,it waits for 2 sec..)...When the number of tasks are getting increased, it is not working properly...So can anybody suggest any idea to work the timer precisely if program is having 3-4 tasks?

thanks in advance

sunil

0 Kudos
2 Replies

440 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Sunil:

Just add to David's comments, I recommend a document about using the MQX timers. please see attached.

Regards

Daniel

0 Kudos

440 Views
DavidS
NXP Employee
NXP Employee

Hi Sunil,

I recommend looking at following example for your application needs:

C:\Freescale\Freescale_MQX_4_2\mqx\examples\timer

Regards,

David

PS

Sorry to not have time to look at your specific question in detail (heading out for 2 week vacation) but with multiple tasks please make sure their priorities are preventing the 1 second callback from working.  Another quick idea is to raise the priority level of that 1 second task to be higher than other tasks.  But I still think the "timer" example above might be better solution.

0 Kudos