Unable to Interpret data received from FTM Input Capture

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Unable to Interpret data received from FTM Input Capture

跳至解决方案
1,671 次查看
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 项奖励
回复
1 解答
1,660 次查看
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 项奖励
回复
2 回复数
1,661 次查看
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 项奖励
回复
1,644 次查看
soham_borkar
Contributor I

Hi Petr,

Thanks for your help ,Solution solved our problem.

 

Regards

Soham Borkar

0 项奖励
回复