PWM output incorrect

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi,

   

 

   

I am trying to get a 1KHz output from a PWM.  I am using a 8 bit PWM with the following configurations.

   

 

   

Clock - VC2 (VC1 divider = 16; VC2 divider = 15)

   

Period = 99

   

Pulsewidth = 50

   

 

   

With VC2 clock at 100KHz, with PWM period of 99, the output should be 1KHz.  But I am getting an output near 240KHz from the PWM.  Can someone point me what could be the mistake?

   

 

   

Regards,

   

Koushi

0 Likes
1 Reply
MR_41
Employee
Employee
First like received

From the data you have provided the only possible problem in your design could be the ClockSync parameter of the PWM.  Have you set this to "Use SysClk Direct"?  When the ClockSync parameter is set to "Use SysClk Direct", it overrides the clock parameter and connects the 24MHz clock to the PWM.  With a 24MHz clock and a period of 99, the output would be 240KHz.  Change the ClockSync to "SyncToSysClk" and that should fix your problem.

   

 

   

Best Regards,

   

Ganesh

0 Likes