S32K148EVB: Measure duty cycle using FTM PWM

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

S32K148EVB: Measure duty cycle using FTM PWM

1,128 次查看
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 项奖励
回复
2 回复数

1,084 次查看
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 项奖励
回复

1,087 次查看
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 项奖励
回复