How to get a timer component to timeout in us?

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get a timer component to timeout in us?

Jump to solution
453 Views
Senior Contributor I

Hi All,

Now I am trying to use the timer component in MQX4.0.1.

Is it possible to make the timer timeout in us? Or what's the resolution for the timer component?\

Thank you.

-Daniel

0 Kudos
1 Solution
43 Views
NXP Employee
NXP Employee

Hi Daniel,

I have not used hwtimer but if you can reach the period you need for your interrupt there is no porblem.

In case you cannot reach the desired period with hwtimer you may try with the PIT. The difference is that hwtimer is an MQX driver and the interrupts is handled by the RTOS while the example I provided can bypass MQX, the interrupts are handled directly by the core andd you can get a smaller period.

BR,

Carlos

View solution in original post

0 Kudos
5 Replies
43 Views
NXP Employee
NXP Employee

Hi Daniel,

Please take a look to the thread below, here 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
43 Views
Senior Contributor I

Hi Carlos,

Thank you.

Now I am using the hwtimer in MQX to generate the interrupt in micro-second and it seems working.

Is there any disadvantage of using hwtimer?

-Daniel

0 Kudos
44 Views
NXP Employee
NXP Employee

Hi Daniel,

I have not used hwtimer but if you can reach the period you need for your interrupt there is no porblem.

In case you cannot reach the desired period with hwtimer you may try with the PIT. The difference is that hwtimer is an MQX driver and the interrupts is handled by the RTOS while the example I provided can bypass MQX, the interrupts are handled directly by the core andd you can get a smaller period.

BR,

Carlos

View solution in original post

0 Kudos
43 Views
Senior Contributor I

Hi Carlos,

Thank you. For the hwtimer, I can get a 3us accurate period, and it works for me.

-Daniel

0 Kudos
43 Views
Contributor II

Hello Daniel,

Would you please give me more details on how you got us resolution in hwtimer? The smallest resolution I could get is 1ms by using  hwtimer_set_period().

I could use PIT approach as Carlos mentioned in the last post but I would prefer to stick with MQX handler.

Cheers!

0 Kudos