About the S32k142 timer Capture initializer crash

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

About the S32k142 timer Capture initializer crash

ソリューションへジャンプ
826件の閲覧回数
Lw2
Contributor III

When I use s32k142, I encounter the abnormal phenomenon of timer capture, hope someone can help to see the reason, thank you here. Let me describe the problem first.

I first explain the code functions: 1, using timer 0 as PWM output 2, using timer 1 as input capture 3, using timer 2 as timing count, 4 using ADC0 ADC1 channel for ADC acquisition

When I initialized the functions of each module in main, all the functions were running normally, as shown in the configuration figure below.

Lw2_0-1725506892198.png

But when I wrap all the initialization into a function and input a PWM signal to any of the capture pins, the running program crashes.

Lw2_2-1725508618243.png

Lw2_3-1725508714099.png

If I block the timer capture configuration, the program works.

Lw2_4-1725508916120.png

What is the cause of this, why the timer capture configuration function into its own wrapped function will crash phenomenon.I have put the source code above, I hope it can be solved, thank you.

 

0 件の賞賛
返信
1 解決策
761件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @Lw2,

Can you test it with these structures being global not local?

danielmartynek_0-1725970233864.png

 

Thank you,

BR, Daniel

 

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
762件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @Lw2,

Can you test it with these structures being global not local?

danielmartynek_0-1725970233864.png

 

Thank you,

BR, Daniel

 

0 件の賞賛
返信
701件の閲覧回数
Lw2
Contributor III

Thank you very much for your reply,BR, Daniel.

After I changed it to a global variable, it worked fine.

Lw2_0-1726637309160.png

Thank you for helping me solve the problem.