Noise in Analog Section | Cypress Semiconductor
Noise in Analog Section
First, a bit of background. I last used the PSoC about 8 years ago, on a project that was strictly digital, programmed in assembly. It worked great. Fast forward to today, and I'm trying to use the 8C29466. Since this project is fairly simple, I decided it would make a good first intro into programming in C. Recipe for disaster? I hope not...
Here's what I'm up to. In short, I am building a small audio mixer. I started with the excellent app note AN16833 (http://www.cypress.com/?rID=2925) and the author's website and revisions here: http://www.cpeproto.com/mixer.html . What he's doing is using the SC and CT blocks in the PSoC to implement a 4 stereo input audio mixer, and in the process demonstrate some neat routing and use of the generic SC block User Module.
My device shares the analog layout of his, but the rest is rather different. I'm using the standard DMX512 UM to receive DMX data to adjust the levels of the mixer. I'm doing this for testing at the moment, as I am easily able to generate a DMX stream to experiment with. Later I may switch protocols. However, the idea will remain the same, and is fairly simple. Take the data in, and use it to modify the levels of the op-amps in the mixer. My goal here is to have a small digitally controlled mixer to combine a few different audio streams. It doesn't have to be perfect, but I will be listening to it for a few hours at a time, so I'm making an effort to keep it clean. I have run into a few problems though, and after working on this without a ton of progress for the last couple days, I need some help. I should mention that I am currently breadboarding this on the CY3210 sample board, so keep that in mind in case it's part of my problem.
My main problem right now is that the signal I'm passing is subject to a couple of different kinds of noise. First off, there is a hiss, centered around 4KHz, that is quite noticeable. That might be inherent in how the op-amps are configured, but I'm wondering if there's anything I can do to reduce it. The level does change as I adjust the op-amp levels, but even with everything at 0, it's still there.
Second is a bit trickier to explain. The DMX512 UM handles receiving data and puts it into a buffer for you. Originally I had a main while(1) loop that read the values, matched them to the gain they were supposed to be adjusting, and then updated the correct SC block register. This caused a high pitched whine. Through a bunch of trial and error, I seem to have determined that if that loop is a certain length, it generates noise in the op-amps. This is with all gains at 0. I pared the loop down to a single if statement that checked the first channel, if the old and new values were different, it would update the current value, then update the SC block. That ran without noise. I copied it so that it ran twice in succession, and it made the noise. Changing the number of times it ran seemed to change the frequency of the noise. In fact, just running a counter in that loop, and not updating anything made a noise.
What I've done for the moment is move those if statements into the DMX512 ISR, so that they only run once per packet. There's no reason to have them run more frequently, the data can't change in between packets anyway. It does feel like a bit of a cheat though, as I haven't really solved the problem. Even with this change, I can hear a ticking noise whenever I'm receiving DMX.
So...what am I doing wrong? I am really confused. I can't imagine that the analog system would be this noisy and subject to interference, or what could would it do folks who are trying to use it to measure things?
Any thoughts would be appreciated. I am happy to share my code and Designer files if that would help, I just didn't want to bombard the forum with files.