It seems clear that the PWM is corrupting your
ADC readings. The question is "How?". Do the PWM traces run next to the
ADC traces? If they do and their edges are sharp, there could be some noise
induced into the ADC traces. Rounding off the edges with a capacitive
load or series resitance would help.
Maybe there are some current spikes on your
board when the motor is running, and these spikes are affecting the ground
of the ADC circuitry. A good way to test that would be to run the
PWMs without the motor hooked up and see if the problem goes
away.
VREF should be as noise free as possible, and
the dedicated power supply pins for the ADC also. .01 uF and 1000 pF ceramic
capacitors are better at filtering high frequency noise than 0.1 uF caps because
their impedance is lower at high frequencies. 0.1uF caps are a hangover
from the time when 1 MHz was considered a high frequency.
You say there is no load on the PWM pins, but
if they are driving the gate of a small FET there could easily be 20 or 30 mA
current spikes on the pin, and that could be inducing some noise internal to the
chip. (I am using an Atmel microcontroller with an ADC, and they recommend that
no I/O pins switch while ADC measurements are being made.) Series resistance
would fix that, too.
My 2 cents worth,
Doug
|