S32K148EVB: Measure duty cycle using FTM PWM

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

S32K148EVB: Measure duty cycle using FTM PWM

1,125 Views
emb02
Contributor V

Hello,

I am currently using S32 Design Studio 3.5 with the S32K148 MCU. I have configured a port as an input and I would like to measure both the duty cycle and frequency using the FTM (FlexTimer Module) in PWM input mode.

However, the example code provided (specifically in the S32K148_signal_measurement project) seems to only cover frequency measurement. Could you please guide me on:

  1. Which FTM mode should I use to measure both duty cycle and frequency?

  2. Is there any example code or sample implementation available that demonstrates duty cycle measurement using FTM?

Any help or code snippets would be greatly appreciated.

Thank you

0 Kudos
Reply
2 Replies

1,081 Views
cherry45scott
Contributor I

Hello,

I am currently using S32 Design Studio 3.5 with the S32K148 MCU. I have configured a port as an input and I would like to measure both the duty cycle and frequency using the FTM (FlexTimer Module) in PWM input mode.

However, the example code provided (specifically in the S32K148_signal_measurement project) seems to only cover frequency measurement. Could you please guide me on:

  1. Which FTM mode should I use to measure both duty cycle and frequency?

  2. Is there any example code or sample implementation available that demonstrates duty cycle measurement using FTM?

Any help or code snippets would be greatly appreciated.

Thank you

 

You're on the right track with the FTM in PWM input mode! To measure both duty cycle and frequency, you should use the FTM in Input Capture mode. This mode allows you to capture the rising and falling edges of the PWM signal, which can then be used to calculate both the frequency and duty cycle.

For example implementations:

  • The NXP Community has a discussion on measuring duty cycle using FTM PWM, which might be helpful for your use case.
  • The S32K1xx Series Cookbook provides software examples, including FTM usage.
  • There is also a GitHub repository with S32K148 cookbook examples that might contain relevant implementations.

0 Kudos
Reply

1,084 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@emb02

here is a similar demo for your reference.

in this demo, FTM ICU mode used for measure duty cycle and frequency.

https://community.nxp.com/t5/S32K-Knowledge-Base/S32K1-Calculate-the-motor-speed-based-on-the-FTM/ta...

 

0 Kudos
Reply