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.