Hi,
I have a custom board having an s32k146. I am using FreeRTOS for running the s32k. I want to use the FTM input capture mode to detect the data sent using an ultrasonic sensor, which is using pulse coded protocol for data communication with the s32k. My PTD16 pin is configured as GPIO which is configured for output mode i.e it sends command from the s32k to the USS. PTD15 is configured as FTM in input mode i.e it will receive the data sent from the USS.
I do not know how to use the FTM input capture mode to detect the signal. Currently I have configured the FTM as follows:
//flexTimer_ic1.c
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 */
NULL /* Vector of callbacks for channels events */
}
};
and this is how I initialize it
//main.c
/* Initialize FTM instances, PWM and Input capture
* - See ftm component for more details
*/
FTM_DRV_Init(INST_FLEXTIMER_IC1, &flexTimer_ic1_InitConfig, &ftm1StateStruct);
/* Setup input capture for FTM 1 channel 0 - PTB2 */
FTM_DRV_InitInputCapture(INST_FLEXTIMER_IC1, &flexTimer_ic1_InputCaptureConfig);
Kindly help me understand write the logic to use this FTM component to read the data from the data line
I am attaching a screenshot of the data which is sent by the USS.