PWM period/Duty calculation

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

PWM period/Duty calculation

跳至解决方案
1,724 次查看
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 项奖励
回复
1 解答
1,702 次查看
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 项奖励
回复
2 回复数
1,703 次查看
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 项奖励
回复
1,675 次查看
AjRj14
Contributor III

Thanks for the reply

0 项奖励
回复