Hi Team,
We are using S32K146 microcontroller, we need any one input pin as Input capture pin, can you please suggest me with which module should I configure?
If I use FTM as signal measurement, am I able to achieve input capture function? Or shall I use ic_pal functionality?
Please support
Thanks
Shruthi C
Hi Petr,
Im unable to use INT_SYS_InstallHandler(FTM0_Ch0_Ch1_IRQn, PWM_InputCapture_IRQHandler, NULL); function as its taking default handler and not taking this handler FTM0_Ch0_Ch1_IRQn
My configurations are
Hi,
yes, those functions should be enough. SDK driver enables FTM channel interrupt, right handler should be assigned from startup, I think. If not right handler is FTM0_Ch0_Ch1_IRQHandler.
The FTM_DRV_GetInputCaptureMeasurement is called to get captured value.
BR, Petr
Hi,
the most common and efficient way is to configure FTM in input capture mode and use pin which has FTM functionality. Each FTM channel can be configured for input capture mode, where it captures the timer value on an edge (rising, falling, or both) of the input signal. This is commonly used for measuring: signal period, pulse width, frequency.
The IC PAL driver allows to detect the input signal and measure pulse width or period of the channel input signal. It was designed to be portable across all platforms and IPs which support FTM , eMIOS, FLEXPWM and ETIMER.
So if you want full control and performance use FTM directly. If you want simpler code and portability use IC PAL.
BR, Petr
Hi,
there is SDK example you can refer to directly (ftm_signal_measurement).
Or share simplified project showing the issue.
BR, Petr
HI,
In SDK example I referred to directly (ftm_signal_measurement).
In this example they did not used Interrupt method they used polling method then they called FTM_DRV_GetInputCaptureMeasurement
Im looking for FTM signal measurement with interrupt, once input capture recognizes the signal, I need interrupt to be triggered and call FTM_DRV_GetInputCaptureMeasurement function in ISR
Can u pls provide code for this
Thanks
Shruthi C
Hi,
if you need to install handler again you should have
extern void FTM0_Ch0_Ch1_IRQHandler(void);
INT_SYS_InstallHandler(FTM0_Ch0_Ch1_IRQn, FTM0_Ch0_Ch1_IRQHandler, NULL);
BR, Petr
Hi,
Yes I do have that function defined, but after that the function call goes to infinite loop, and it will run further
Shruthi_C_0-1764752920959.png
The whole system will not work,
Thanks
Shruthi C
Hi,
Thanks for your support, and code snippet, I will check
T&R,
Shruthi C
Hi,
Can I get any input for interrupt enabled FTM pin as input capture
Thanks
Shruthi C
Hi,
driver is using interrupt for capture event, only not shown in example directly.
I modified FTM IC setting to use one shot mode and add Callback, which is called from driver interrupt.
See attached for modified main.c of ftm_signal_measurement_s32k146 demo.
BR, Petr