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 ?