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:
Which FTM mode should I use to measure both duty cycle and frequency?
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.