PWM period/Duty calculation

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

PWM period/Duty calculation

ソリューションへジャンプ
1,697件の閲覧回数
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,675件の閲覧回数
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,676件の閲覧回数
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,648件の閲覧回数
AjRj14
Contributor III

Thanks for the reply

0 件の賞賛
返信