PWM showing deviation in the Duty cycle

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

PWM showing deviation in the Duty cycle

跳至解决方案
3,832 次查看
Ajul
Contributor I

Hi I was working on nxp s32k324 controller . The PWM out put duty cycle showing 2.7 to 3 % difference . when we give the 0x4000 then we are expecting an PWM output with 50% duty cycle but we getting an PWM signal with  53% duty cycle . We are using 160MHz clock and we used the EmiosChPrescaler : EMIOS_PWM_IP_CLOCK_DIV_16 so the resultant clock to the emios is 10MHZ.

we need to run the PWM at 500Hz So we used the PWM period default to 20000 ticks.

 

And we are also noticed when the frequency is more then the  deviation is also more for eg if we are running the pwm at 1khz then the deviation is 6.3% Could you please help as to resolve the issue? Attached the wave forms

标记 (1)
0 项奖励
回复
1 解答
3,667 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hello Ajul,

To determin the duty-cycle, we need to have the value of the A register.

Something like this:

danielmartynek_0-1686744053200.png

In the image you posted, the register is cleared.

 

Regards,

Daniel

在原帖中查看解决方案

0 项奖励
回复
10 回复数
3,466 次查看
Ajul
Contributor I

Hi Daniel

 

Thank you for the support ,

 

Regards

Ajul

0 项奖励
回复
3,547 次查看
Ajul
Contributor I

Hi Daniel

Please find the attached document for the register values

Regards

Ajul

0 项奖励
回复
3,532 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @Ajul,

I just sent you my test project.

Do let me know if you have any question.

 

Thank you,

Daniel

0 项奖励
回复
3,653 次查看
Ajul
Contributor I

Hi Daniel,

If the register is not set, then How We can Get a controlled PWM output? right now Iam facing deviation in the Duty cycle I can control the PWM output. Could you please explain this? How to fix this issue?

 

Thanks

Ajul

0 项奖励
回复
3,636 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Can you test it with the Emios_Pwm_Ip_Example_S32K342 RTD example?

Or share your project so that I can test it?

If you don't want to share the project here, you can create a ticket.

 

Regards,

Daniel

0 项奖励
回复
3,821 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @Ajul,

Which EMIOS PWM mode do you use? OPWFMB, OPWMCB, OPWMB, OPWMT?

For example, in the OPWFMB mode, the duty cycle determined by AS1 and the period of BS1.

Can you read the register in with the debugger?

Below is a timing diagram of the expected PWM signal at the output pin.

danielmartynek_0-1686149030345.png

 

Thank you,

BR, Daniel

 

 

0 项奖励
回复
3,804 次查看
Ajul
Contributor I

Hai  Daniel 

Thank you for the response 

Iam Using EMIOS_PWM_IP_MODE_OPWFMB mode

Attached the register details.

Using eMIOS_0_CH[4]_G for PWM control.

Regards

Ajul

 

 

0 项奖励
回复
3,744 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hello Ajul,

I see that the register A is not set.

danielmartynek_0-1686317559658.png

Was it captured after the initialization while the Emios was running?

 

Thank you,

BR, Daniel

0 项奖励
回复
3,686 次查看
Ajul
Contributor I

Hi Daniel

It is captured during Run time after emios initialization

 

 

Regards

Ajul

0 项奖励
回复
3,668 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hello Ajul,

To determin the duty-cycle, we need to have the value of the A register.

Something like this:

danielmartynek_0-1686744053200.png

In the image you posted, the register is cleared.

 

Regards,

Daniel

0 项奖励
回复