About the S32k142 timer Capture initializer crash

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

About the S32k142 timer Capture initializer crash

Jump to solution
825 Views
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 Kudos
Reply
1 Solution
760 Views
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

 

View solution in original post

0 Kudos
Reply
2 Replies
761 Views
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 Kudos
Reply
700 Views
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.