PDA

View Full Version : PWM Frequency changes


ngkdc
05-11-04, 10:43 AM
I've found that when I'm changing the PWM frequency on PWMA0 while the PWM output is active, the output locks into a high state while resetting the registers; it then returns to the specified duty cycle at the new frequency rate.

Uh ... can you change this to defaulting to OFF during a frequency change by any chance? My immediate fix is to stop the PWM output, make the change, then resume PWM output.

I'm assuming any change of this type would have to wait until the next ISOMAX release.

Thanks,

Rick

RMDumse
05-11-04, 10:58 AM
That's a surprize, we'll look into it.

RMDumse
05-12-04, 03:22 PM
Oh! At first I thought you meant you were changing the period of the pulse, but instead I now understand you were changing the frequency of the pulse.

The PWM generator uses a counter (modulus) and a compare register (PWM value) to generate the output.

According to section 11.5.3.3 of the DSP56801-7 User's Manual,

"Note: A PWM value less than or equal to zero deactivates the PWM output for the entire PWM period. A PWM value greater than or equal to the modulus activates the PWM output for the entire PWM period."

It's likely that this is happening only when you *reduce* the modulus (i.e, specify a shorter PWM-PERIOD), to a value which is lower than the PWM value. Does this fit with what you observe?

The PWM words in IsoMax assumes a fixed PWM frequency (PWM-PERIOD) and then vary the duty cycle with PWM-OUT.

As you can see from the User's Manual note, the HIGH output is a
function of the PWM hardware, and we can't change that. As a workaround we suggest either

a) output zero PWM-OUT, change PWM-PERIOD, then re-output the desired duty cycle with PWM-OUT (forces the output low while frequency is changed), or

b) change PWM-PERIOD, and immediately re-output the desired duty cycle with PWM-OUT (output will be high while frequency is changed).

To change the PWM frequency while leaving all six duty cycles unaffected would require programming outside the scope of the language.

ngkdc
05-12-04, 03:55 PM
[COLOR=green][QUOTE]Originally posted by RMDumse
[B]Oh! At first I thought you meant you were changing the period of the pulse, but instead I now understand you were changing the frequency of the pulse.


[COLOR=blue]
I'm changing both the frequency and duty cycle in one mode, and changing the frequency and keeping a fixed pulse width in another mode (for example I'm specifying a 10 uS wide pulse over a specified frequency range). This second mode will change the frequency based upon sensor feedback




[COLOR=green]The PWM generator uses a counter (modulus) and a compare register (PWM value) to generate the output.

According to section 11.5.3.3 of the DSP56801-7 User's Manual,

"Note: A PWM value less than or equal to zero deactivates the PWM output for the entire PWM period. A PWM value greater than or equal to the modulus activates the PWM output for the entire PWM period."


[COLOR=blue]
Absolutely ... that's what I expect ... and that part works fine.



[COLOR=green]It's likely that this is happening only when you *reduce* the modulus (i.e, specify a shorter PWM-PERIOD), to a value which is lower than the PWM value. Does this fit with what you observe?


[COLOR=blue]
I'll have to check whether it is in the down-mode or always ...




[COLOR=green]The PWM words in IsoMax assumes a fixed PWM frequency (PWM-PERIOD) and then vary the duty cycle with PWM-OUT.

[COLOR=blue]
Not really an issue ... that's what I expect, and what I'm basing my code around. The suprise came when I was changing the PWM-PERIOD, and the PWM output went to VCC rather than to GND during the register update.



[COLOR=green]As you can see from the User's Manual note, the HIGH output is a
function of the PWM hardware, and we can't change that. As a workaround we suggest either

a) output zero PWM-OUT, change PWM-PERIOD, then re-output the desired duty cycle with PWM-OUT (forces the output low while frequency is changed), or

[COLOR=blue]
That's my workaround for now.


[COLOR=green]b) change PWM-PERIOD, and immediately re-output the desired duty cycle with PWM-OUT (output will be high while frequency is changed).

[COLOR=blue]
That's not so good when you are controlling a couple of hundred amps with the PWM output (through suitable switching devices mind you!). That is called "runaway mode".



[COLOR=green]To change the PWM frequency while leaving all six duty cycles unaffected would require programming outside the scope of the language.

[COLOR=blue]
Again, not an issue ... When I need to change the frequency, I calculate a new pulse width setting, change the frequency, change the duty cycle and move on. The only issue I had was the PWM output pulling high during the register update rather than it pulling low.

Thanks for the help,

Rick