PWM period/Duty calculation

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

PWM period/Duty calculation

Jump to solution
1,725 Views
AjRj14
Contributor III

 

Hi, 

I am following below application note for PWM period calculation

https://www.nxp.com/docs/en/application-note/AN5303.pdf

 

For PWM period calculation, single edge capture mode is used, but Timer overflow is not considered .

Could you please tell me why timer overflow is not considered?

The PWM period is calculated by : In the interrupt routine, save the value of
the CnV register into a variable and make a difference between the current value and the saved value
from the previous interrupt routine. 

My understanding is when the counter reaches 65535, it then again starts counting from 0. In such a case the current counter value can be lesser than the counter value saved in previous IRQ. So the difference will become negative and incorrect. How is this incorrect counter difference handled?

0 Kudos
Reply
1 Solution
1,703 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

You're right. We can add a software counter to the overflow interrupt to overcome this problem.
Unfortunately, the current SDK does not support this function temporarily, so you will be prompted about the limitations of the current settings

ftm_signal_measurement_s32k144.png

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.
-------------------------------------------------------------------------------

View solution in original post

0 Kudos
Reply
2 Replies
1,704 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

You're right. We can add a software counter to the overflow interrupt to overcome this problem.
Unfortunately, the current SDK does not support this function temporarily, so you will be prompted about the limitations of the current settings

ftm_signal_measurement_s32k144.png

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
Reply
1,676 Views
AjRj14
Contributor III

Thanks for the reply

0 Kudos
Reply