// Sample Channel 11 ConversionComplete = FALSE; ADC_RegularChannelConfig(ADC1, ADC_Channel_11, 1, ADC_SampleTime_13Cycles5); // Select the channel ADC_SoftwareStartConvCmd(ADC1, ENABLE); // Start a conversion while(ConversionComplete == FALSE); // Block until the ISR has fired // Sample Channel 10 ConversionComplete = FALSE; ADC_RegularChannelConfig(ADC1, ADC_Channel_10, 1, ADC_SampleTime_13Cycles5); // Select channel 10 ADC_SoftwareStartConvCmd(ADC1, ENABLE); // Start a conversion while(ConversionComplete == FALSE); // Block until the ISR has fired AmbientAverage += ConversionResult; // Add the result to the averageing variable There seems to be a similar spike to what you're seeing when I sample channel 10. The amplitude of the spike is a higher voltage when channel 11 is higher. It seems to me that the channels are shorting during the channel switching in the multiplexer. Any ideas how to resolve this?
aleh is on the right track. Here is my explanation why, as well as a recommended solution:
The ADC has an input capacitance of 10 pF. This forms an RC network with the signal input impedance. If you use a 30K resistor, channel switching noise doesn't have time to dissipate before conversion. The 100 nF capacitor overcomes the problem by quickly charging the ADC sample and hold input capacitance. The direct wire to ground effectively does the same. While the direct wire to ground can be a test case, it is obviously not a design solution. The 100 nF capacitor forms an RC network with the signal impedance, which can limit the maximum signal frequency. The preferred solution is a low impedance signal source such as an operational amplifier connected to both the ADC input and a capacitor to ground. Check the amplifier's specifications to ensure it will cover the frequency you need and follow the recommendations on maximum capacitance it will drive. Added note: This subject is well covered in AN2834 How To Get The Best ADC Accuracy, sections 2.2.5 and 2.2.6. Figure 19 summarizes it nicely. Anreas1 choice of 10 nF is a good recommendation. Cheers, Hal [ This message was edited by: raptorhal on 23-07-2009 15:30 ]
We saw something similar with an op-amp connected to the ADC input.
The problem was due to the bandwidth of the op-amp being insufficient to deliver the current necessary to charge the ADC's 12 pF capacitor in the short time allowed. Adding an RC filter (1 K and 100 uF; this was a slow-moving signal) solved the problem.