Unable to Interpret data received from FTM Input Capture

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

Unable to Interpret data received from FTM Input Capture

Jump to solution
1,658 Views
soham_borkar
Contributor I

Hi,

The goal of our project is to find the pulse width of received Echo signal(Low signal) from Ultrasonic sensor on FTM pin of S32K146. Ultrasonic signal sends the data in the below format:

Burst signal , Echo / Echo's , 12 status bits.

We have used FTM_DRV_GetInputCaptureMeasurement to measure the signal value.

    if(event == IC_EVENT_MEASUREMENT_COMPLETE)
    {
        data[i++] = FTM_DRV_GetInputCaptureMeasurement(INST_FLEXTIMER_IC1, 0U);
 
    }
for which, the values of data we get are:
Data = 4250
Data = 40933
Data = 24493
Data = 3946
Data = 7182
Data = 10643
Data = 54551
Data = 5054
Data = 5061
Data = 5060
Data = 2660
Data = 5054
Data = 5061
Data = 5060
Data = 2662
Data = 2654
Data = 2654
Data = 5053
Data = 5060
 
From the data shown above, we could conclude that the first value is of Burst signal followed by 6 echoes and 2 status bits , but could'nt interpret the values that we received.
 
Source clock frequency is 48MHZ
 
FTM configuration is as follows:
ftm_input_ch_param_t flexTimer_ic1_InputCaptureChannelConfig[1] =
{
{
0U, /* Channel id */
FTM_SIGNAL_MEASUREMENT, /* Input capture operation mode */
FTM_RISING_EDGE, /* Edge alignment mode */
FTM_PERIOD_OFF_MEASUREMENT, /* Signal measurement operation type */
0U, /* Filter value */
false, /* Filter state (enabled/disabled) */
true, /* Continuous measurement state */
NULL, /* Vector of callbacks parameters for channels events */
read_pwm /* Vector of callbacks for channels events */
}
};
 
Do we need to divide the values by some factor to get the pulse width or is it anything else we are missing ?
 
 
0 Kudos
Reply
1 Solution
1,647 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

in the configuration you have the FTM_DRV_GetInputCaptureMeasurement returns number of ticks counter counts during low pulse. So if you know period or frequency counter is running of, then you can calculate pulse width by multiply counts and counter clock period. 
If you are not aware of counter clock you can use FTM_DRV_GetFrequency, which should return the frequency of the clock source running the FTM counter. Then pulse width will be 
width = counts/frequency.

BR, Petr 

View solution in original post

0 Kudos
Reply
2 Replies
1,648 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

in the configuration you have the FTM_DRV_GetInputCaptureMeasurement returns number of ticks counter counts during low pulse. So if you know period or frequency counter is running of, then you can calculate pulse width by multiply counts and counter clock period. 
If you are not aware of counter clock you can use FTM_DRV_GetFrequency, which should return the frequency of the clock source running the FTM counter. Then pulse width will be 
width = counts/frequency.

BR, Petr 

0 Kudos
Reply
1,631 Views
soham_borkar
Contributor I

Hi Petr,

Thanks for your help ,Solution solved our problem.

 

Regards

Soham Borkar

0 Kudos
Reply