Start a timer in a interrupt?

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

Start a timer in a interrupt?

ソリューションへジャンプ
1,527件の閲覧回数
danielchai
Senior Contributor I

Hi All,

I am using MK60F120, MQX4.0.1, cw10.4.

And now I create a timer to generate a interrupt every 50ms.

When I start the timer in the main task, it works fine. But when I start the timer in a button interrupt, it does not work.

I am using following code to start the timer.

*TimerID = _timer_start_periodic_every_ticks(key_generator, 0, TIMER_ELAPSED_TIME_MODE,Ticks);

Is there something wrong or I can't start a timer in a interrupt?

Thank you.

-Daniel

0 件の賞賛
返信
1 解決策
1,275件の閲覧回数
Martin_
NXP Employee
NXP Employee

Hi Daniel,

MQX timer functions do a call to _lwsem_wait(), under some conditions. _lwsem_wait() can't be called from an isr. Therefore, MQX timer functions should not be called from an isr.

-Martin

元の投稿で解決策を見る

0 件の賞賛
返信
1 返信
1,276件の閲覧回数
Martin_
NXP Employee
NXP Employee

Hi Daniel,

MQX timer functions do a call to _lwsem_wait(), under some conditions. _lwsem_wait() can't be called from an isr. Therefore, MQX timer functions should not be called from an isr.

-Martin

0 件の賞賛
返信