Sampling of a dithered PWM.
I've reached a problem and my limited knowledge of DSP has made it so that I can't figure out the answer. Hopefully you all can help.
Say I have a switching converter, we'll just use a buck, and I am randomly changing my switching frequency on a cycle to cycle basis. So for instance, one switching period might be 4kHz, then 9kHz, then 7kHz, etc. If I look at the sampled current frequency spectrum, I would expect to see contributions within this limited frequency band. Instead, I see a hump centered around the frequency band. I can somewhat understand seeing frequency contributions from the switching frequency and above, but I don't understand why the hump is symmetric down towards DC.
In the image linked, the sampling Frequency was 24kHz, no filtering, and the switching frequency was between 4kHz and 9kHz. Any help would be appreciated. Thanks.
Posted May 28, 2013, 1:12 AM UTC
Ignoring the frequency range for now, the shape of the spectrum looks about like I'd expect. The random shifts in frequency are pretty much like random inputs to a frequency-modulated carrier. You can model the random walk in Matlab:
I get a rounded hump that looks a bit like yours. (You may want to do some averaging when computing the spectrum, e.g. with the psd command or similar.)
As to why it's not in the expected range, your guess is as good as mine. One possibility is that four thousand on or off transitions per second gives a 2 kHz square wave. After that, I would double-check the input sampling frequency, double check the FFT code, and then consider whether the system might actually be operating at a lower frequency than expected.
Thanks for the info. I've used the same code with a fixed switching frequency, and everything seems to line up properly, so I would think that would eliminate the possibility of it being a numeric error?
That would suggest that the DSP code is operating correctly. If that's the case, then the random-frequency mode is not switching at the expected rate.
It might be a good idea to validate the observed output in fixed-frequency mode. Get a frequency counter or something if you can, just anything that can get you a reliable reading that's known to be bug-free.