Using FTM input capture for capturing ultrasonic data

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

Using FTM input capture for capturing ultrasonic data

Jump to solution
2,017 Views
shravanmanerikar
Contributor I

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. 

0 Kudos
1 Solution
1,972 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

We do not have a project that fully meets your requirements. You can refer the project attached in How to use FlexIO configuration to SENT(SAE-J2716). The KMA320 is configured to transmit the angle values via SENT interface, and S32K144 captures each pulse in the SENT frame by FlexTimer input-capture feature, then triggers DMA request.

View solution in original post

0 Kudos
3 Replies
2,000 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi shravanmanerikar,

If pulse coded protocol means: Single Edge Nibble Transmission protocol (SENT, SAE J2716)

Then there are two examples that you can refer:
SENT receiver for S32K118 Design Studio
Uart to SENT protocol transmitter

Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
1,988 Views
shravanmanerikar
Contributor I

Hi Robin,

We aren't using UART to capture the signal from the USS. Instead we have connected the USS_RX pin directly to the PTD15 pin which is configured to FTM0_CH0. We have used the FTM input capture component from the s32 SDK. Can you please provide the code/example for the same??

Thanks and regards,

Shravan Manerikar

0 Kudos
1,973 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

We do not have a project that fully meets your requirements. You can refer the project attached in How to use FlexIO configuration to SENT(SAE-J2716). The KMA320 is configured to transmit the angle values via SENT interface, and S32K144 captures each pulse in the SENT frame by FlexTimer input-capture feature, then triggers DMA request.

0 Kudos