I'm trying to read an audio signal from an Android phone as a serial input to an MSP430G2553 (datasheet: http://www.kynix.com/uploadfiles/pdf65976/MSP430G2553IN20.pdf), adapting this design to use the MSP430's onboard comparator module instead of an LM324. The Android code to make a square wave out of the audio jack is available here. The output is not pretty, but that's for another question.
In my case, the comparator's positive input is the internal precision voltage reference (0.5*VCC) instead of an external pot. I have applied a DC bias to the audio signal in order to center it around the 0.5*VCC mark before going to the comparator's negative input on P1.5 (CA5) like so (the AUDIO net is CA5):
Here's where things get weird. Now, if I plug in USB to the Launchpad to debug, the DC bias on the CA5 input cuts in half from 1.6V to about 800mV. What could possibly be causing this?
- Confirmed that ground between the MSP430 Launchpad board and my perfboard are nicely connected together like they should be.
- Set up all of my MSP430 peripheral config in the Grace GUI tools so there's no chance of a careless mistake in setting up a register.
- Disconnecting the jumper that powers the MSP430 over USB and powering up the 3.3V regulator on my perfboard (there's a DIP socket on the perfboard waiting for the MSP430 once I'm done debugging code). Neither source solves the problem, and the measured VCC-GND voltage is exactly 3.3V in both cases.
- If I run the MSP430 off external power with the USB cable disconnected (no debugging!), I get my 1.6V bias like normal.
- Took my laptop out and verified that it wasn't something weird with my work computer, connecting USB to the laptop causes the same behavior.
- The bad 800mV bias will temporarily go up to the desired 1.6V if I hold the MSP430 in reset with the pushbutton on the Launchpad. Releasing it from reset immediately restores 800mV.
- Swapped in another MSP430G2553.
I have no experience with this TI platform which makes this little more than a guess, but it appears that the load on the AUDIO signal changes when you plug in USB to the Launchpad to debug. Based on the drawing there isn't much else that would explain what you're seeing, particularly if you see this with nothing plugged in to the audio jack.
It appears that you have a very high impedance on AUDIO with USB disconnected, and this changes to about 47k to GND with USB connected for debug. Something seems to change in the way the circuitry to which AUDIO is connected is being handled or configured when USB is connected.
From your cct and the symptoms you describe the MSP430 (or something else in the launch pad cct) MUST be drawing current through the potential divider Rs to ground. You already have some evidence of this in that holding the MSP430 in reset changes the voltage. Odd that it seems to work as expected with the USB removed.
So it's back to the data sheet. Find out the input impedance of the comparator connection, don't forget it's an IO pad as well and may very well have pull up and/or pull down capability. Initialisation code might be 'doing something' with the pad configuration and as you are relying on an external code generator to produce the initialisation code who knows what's going on. Once its running trawl through the pad and comparator configuration reg settings and check they are set how you want them. Tedious but might be worth it.
Make sure all the earths are solidly wired together, that is Android audio source, your interface bd, debug board and USB connection. Check this with a high speed 'scope if you have one to make sure there's no unexpected HF oscillation taking place due to the USB interface. Don't forget the USB is coming form a PC and hence a switch mode PSU. They can be quite noisy. Also look at the signal you've named AUDIO and make sure it is what you expect from the phone. Do this with no signal coming from the phone and you should have a steady, interference free DC level.
To prove current is being drawn into the MSP board put another 100 k resistor in series with your AUDIO connection and check the voltage across it. If the MSP input (+ Launch Pad circuitry) is high impedance there should be almost no DC or AC voltage across the R.
Hope that helps.