PWM showing deviation in the Duty cycle

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

PWM showing deviation in the Duty cycle

Jump to solution
3,830 Views
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

Tags (1)
0 Kudos
Reply
1 Solution
3,665 Views
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

View solution in original post

0 Kudos
Reply
10 Replies
3,464 Views
Ajul
Contributor I

Hi Daniel

 

Thank you for the support ,

 

Regards

Ajul

0 Kudos
Reply
3,545 Views
Ajul
Contributor I

Hi Daniel

Please find the attached document for the register values

Regards

Ajul

0 Kudos
Reply
3,530 Views
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 Kudos
Reply
3,651 Views
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 Kudos
Reply
3,634 Views
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 Kudos
Reply
3,819 Views
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 Kudos
Reply
3,802 Views
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 Kudos
Reply
3,742 Views
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 Kudos
Reply
3,684 Views
Ajul
Contributor I

Hi Daniel

It is captured during Run time after emios initialization

 

 

Regards

Ajul

0 Kudos
Reply
3,666 Views
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 Kudos
Reply