April 12th, 2011, 11:08 pm
It seems like when I hold the PWM duty cycle at a constant number, I get a faint hiss. Even 0. I have two of these op amps lined up with some resistors, I think this is what creates the low-pass filter:QuoteThe MCP6022 dual operational amplifier (op amp) has a gain bandwidth product of 10 MHzI am adjusting the duty cycle 8000 times per second, or once every 9000 ticks where the pulse width modulator is running at 72000000 ticks per second. I am guessing it is some kind of aliasing where the duty cycle is not some neat multiple, and/or my low-pass filter isn't low enough. I am trying to kill it by turning off the amplifier where there are gaps in the audio, or lowering the clock speed of the PWM or something. But maybe I need different op amps geared towards 8000 samples per second.Ever heard of anything like this?I cut the PWM clock down to 36000000 ticks a second, and I think the hiss changed. It also seem to fade in and out with a period of greater than 11 to 19 seconds, and two odd subcycles. But it also could just be my ears playing tricks on me. One question I have is about the clock speed. If I am using the onboard clock on the chip, or even a crystal, is there some variation in the actual clock speed? One time I was running it off my car electric system, and I swear the frequency changed when I turned on and off the headlights, starter, stereo, and stuff.Incidentally, I should mention that using audio to debug and understand the cadence of your programs is way better than anything you can put on a screen. I have used blinking lights, characters, a debug output, everything with this little project. And the audio beats all for telling you what is really happening. Anybody running high speed threads you should put clicks inside them, and hook a speaker up to your computer. The ear can tell the difference between a thread spinning 8500 times per second and 8600 times per second. The ear is a poor man's oscilloscope.Anyway, I begin to think the hiss is coming from the power source not the chip. It interacts with the chip's use of the power, and the proper audio's use. So the solution is some kind of a low pass filter on the power pin to the amp? Hopefully it will just go away when I switch to battery. But this must be a common problem in electronic audio equipment, no?
Last edited by
farmer on April 12th, 2011, 10:00 pm, edited 1 time in total.