How to read the PWM Signal as input at the NXP S32K148

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

How to read the PWM Signal as input at the NXP S32K148

1,336 Views
rohit_alate
Contributor II

Hello Team,

I am working on an application where I need to read the PWM signal data and transfer that data over CAN,
I did with transferring the data over the CAN-BUS.
But I am not getting how I can read the PWM signal on the pin, is there any reference example it will be really helpful or anyone guide in this.


Board : S32K148 - EVAL

I am new In these things,
Thanks in Advance.
Rohit


0 Kudos
3 Replies

1,332 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@rohit_alate

The appendix files are already included in the S32 DS SDK

S32 Design Studio for ARM

Version: 2018.R1

RTM SDK 3.0.0

        There is a example application "ftm_signal_measurement_s32k148" showing the FTM's Signal Measurement functionality.

        Usage or details please refer to "ftm_signal_measurement.dox" in Project "Doxygen folder"

        The application is configured to generate a PWM signal with a variable frequency which will be measured another FTM instance. The frequency will range from 300 Hz to 3000 Hz. Each step changes 100 Hz. The measurement result will be sent to the host PC via LPUART. User is able to compare pwm frequency and measurement frequency.

BR!

     Jim,

--------------------------------------------------------------------------------------------------------------------------------------
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,320 Views
rohit_alate
Contributor II

hello @Senlent ,

Thanks for the quick support,
I went through the example and I get to know that it is calculating the PWM Frequency, but I want to calculate the frequency and Ton Time for the given PWM signal, so from example, I can get the frequency but how to calculate or get the Ton time for the PWM Signal.

Thanks,
Rohit

0 Kudos

1,310 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@rohit_alate

Hi, Rohit 

     There is no such routine in S32 DS, but you can try to calculate the duty cycle and frequency in the following way.

1.Configurate FTM->IC module.

Senlent_0-1636537713618.png

2.Calculate the duty cycle according to the timestamps corresponding to the rising and falling edges

//Interrupt->detecd edge signal rising or Falling
void SENA1_IN_DET()
{
    /*Step1 -> the signal is rising or falling by reading GPIO level */
    
    /*Step2 -> Get Timestamp
     Timestamp= FTM_DRV_GetInputCaptureMeasurement(.....);*/
    
    /*Step3 -> Calculate the Ton or frequency by timestamp*/
}

 I use this method to calculate the speed of the motor.

BR!

     Jim,

0 Kudos