How can I measure the microseconds external Signals using S32K144 FTM Input Capture

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

How can I measure the microseconds external Signals using S32K144 FTM Input Capture

2,002 Views
sakthivelkuland
Contributor III

Dear All,

For my project, I need to measure the external Signals high and Low period using FTM input capture Mode,

1) The external signal is in a microsecond (example High: 60us and Low:60us).

2) I have used the FTM0 ch6 for my IC module.

3) How to set up the FTM0_init Timer setting for measure the microsecond.

If anyone has measured the microsecond external signals using the IC mode,

Please help me to configure the FTM0.

Any other methods are available please let me know.

Thaks in Advance

Regards,

Sakthivel K

Labels (1)
Tags (1)
0 Kudos
Reply
3 Replies

1,541 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello Sakthivel,

You need to use Dual-edge capture mode.

You may refer to AN5303 Features and Operation Modes of FlexTimer Module on S32K.

AN5303SW, SW5.

Please do not import the project.

The code was written for the first S32K144 maskset 0N77P, there are outdated header files.

Regards,

Daniel

0 Kudos
Reply

1,541 Views
sakthivelkuland
Contributor III

Hello Daniel,

Thanks for your response and reference document.

My requirement is single external signal(Sensor) has been input to the MCU for measure the width of the High and Low duration.

Is that Dual-edge Capture Mode can able to capture width of both the edge of the input signal.

This examples with the document are measure only the postive edge of the signals.

Can I use the Single-edge capture mode with configuration of the rising and falling edge interrupt , In ISR can calculate the with of input signal.

How to initialize the clock for the FTM Module and pre-scaler values?

Regards,

Sakthivel K

0 Kudos
Reply

1,541 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello Sakthivel,
There are two capture modes: Input capture mode and Dual-edge capture mode.
Input capture mode uses only one channel and generates interrupts when an active edge occurs in the channel input. Section 44.5.5, RM. It can be configured to generate interrupts on both edges. See Table 44-5.
But for pulse width measurement there is the Dual-edge capture mode which uses two channels (channel (n) and (n+1)) to capture active edges of the channel (n) input. This allows to measure positive/negative pulse width or period/frequency of the input signal. If both channel (n) ELSB:ELSA and channel (n+1) ELSB:ELSA bits select the same edge, then it is the period measurement. If these bits select different edges, then it is a pulse width measurement. Section 44.5.26.

Regarding the clock initialization, it depends on the resolution you want to have. The FTM peripheral functional clock frequency can be up to SYS_CLK which is max 80MHz in RUN mode and 112MHz in HSRUN mode. The AN5303 project selects 112MHz from SPLLDIV1_CLK in HSRUN.

Regards,
Daniel

0 Kudos
Reply