How to get a timer component to timeout in us?

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

How to get a timer component to timeout in us?

ソリューションへジャンプ
1,065件の閲覧回数
danielchai
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 件の賞賛
1 解決策
655件の閲覧回数
Carlos_Musich
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

元の投稿で解決策を見る

0 件の賞賛
5 返答(返信)
655件の閲覧回数
Carlos_Musich
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 件の賞賛
655件の閲覧回数
danielchai
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 件の賞賛
656件の閲覧回数
Carlos_Musich
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

0 件の賞賛
655件の閲覧回数
danielchai
Senior Contributor I

Hi Carlos,

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

-Daniel

0 件の賞賛
655件の閲覧回数
troide
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 件の賞賛