3
\$\begingroup\$

I am using a STM32 Cortex M3 microcontroller and have configured the ADC. I have verified that the ADC works by measuring different voltages on the micro controller eval. board.

When I connect my ADC to the output of the op amp (MCP6002) the signal gets distorted. A picture showing how the signal looks at the output before and after I connect the ADC is shown below.

The ADC pin is configured as analog in (as it should). When connecting pins with other configuration the signal is not distorted. The op. amp. is powered by the microcontroller eval. board.

Any help is much appreciated! =)

EDIT: Added schematic. Actual op. amp. used is MCP6002 instead of those shown in circuit. When I connect ADC1 to the ADC on my microcontroller the signal gets distorted.

EDIT2: Additional observation: When scoping and placing the ADC to the 3.3V power rail provided by the microcontroller the scope reads 3.3V. When doing the same with GND i read 0V. But when connecting it to the (3.3V / 2) virtual GND made by one of the MCP6002 op. amps. the result is the same as the distorted picture below.

EDIT3: I just set up a new ADC with identical settings (I will compare them agian) and it works. I assume I will find some error in code/configuration somewhere. I will let you know.

EDIT4/Solution: I am again amazed by myself. The same pin has been configured as a digital push-pull somewhere else in code, but no longer used by this module. This code has been present for over a year, but since it probably always have been initialized before the ADC, the ADC have been overwriting the pin configuration and everything has been working fine. This was until the ADC initialization had been moved and done before the other configuration, making the ADC configuration overwritten as a digital input push-pull. I wish to thank all for the great help and input and their time.

Before on top and after on bottom

Schematic

\$\endgroup\$
8
  • 1
    \$\begingroup\$ Did you disable the digital input on the pin, if any? \$\endgroup\$ Commented Nov 6, 2013 at 0:04
  • \$\begingroup\$ @IgnacioVazquez-Abrams: As far as I know there is no option to do this. These are the possible modes: GPIO_Mode_AIN, GPIO_Mode_IN_FLOATING, GPIO_Mode_IPD, GPIO_Mode_IPU, GPIO_Mode_Out_OD, GPIO_Mode_Out_PP, GPIO_Mode_AF_OD, GPIO_Mode_AF_PP \$\endgroup\$ Commented Nov 6, 2013 at 0:15
  • 1
    \$\begingroup\$ add a 10nF on the input to the ADC. Equally consider putting a 100R or 1k to make a low-pass filter. The ADC is a sample & hold type. \$\endgroup\$
    – user16222
    Commented Nov 6, 2013 at 0:15
  • \$\begingroup\$ @Naib: I tried both. Did not fix this. \$\endgroup\$ Commented Nov 6, 2013 at 0:26
  • 1
    \$\begingroup\$ Please post a schematic. \$\endgroup\$ Commented Nov 6, 2013 at 0:28

3 Answers 3

4
\$\begingroup\$

A few things to make sure of:

  • Make sure you have decoupling capacitors (e.g. 100nF) on all opamp power pins.
  • As a unity gain configuration is sensitive to capacitive load (the ADC input pin), try isolating it using a series resistor (between opamp output and ADC input), value say between 220Ω and 820Ω.
  • Make completely sure there is nothing else affecting the ADC input, and it is set correctly as an analog input - check it with a known source such as a signal generator to confirm the same does not happen.
  • Make sure the analog section and the uC share a common ground.
  • Check none of the opamps are oscillating at any point.
  • Check supply rails are okay (check under load also)

Let us know how it goes, it should be a reasonably easy issue to track down, but no doubt Murphy will have something to say about that ;-)
A proper schematic with all parts present would be helpful (i.e. I'm assuming the opamps have decoupling caps but you did not include them on the LTSpice schematic)

\$\endgroup\$
2
  • \$\begingroup\$ Decoupling capacitors are in place. Testing directly with signal generator (DDS chip) to the ADC the sine signal is there, but attenuated with a factor of approx. 6. This is probably due to imperfect impedance matching? Analog and uC share common ground. All supply rails checked and have correct voltages. Tried changing the op.amp. (just in case) and also trying the LM358 op.amp., but same problem (except that the DC was then 700 mV vs 400 mV shown in OP). Tried using a series resistor (470 Ohm) and that gave the sine shape, but with 25 mV peak-peak. 680 Ohm gave 10 mV peak-peak. \$\endgroup\$ Commented Nov 6, 2013 at 15:57
  • \$\begingroup\$ Additional observation: When scoping and placing the ADC to the 3.3V power rail provided by the microcontroller the scope reads 3.3V. When doing the same with GND i read 0V. But when connecting it to the (3.3V / 2) virtual GND made by one of the MCP6002 op. amps. the result is the same as the distorted picture in OP. \$\endgroup\$ Commented Nov 6, 2013 at 16:10
1
\$\begingroup\$

From the voltage level you see on the pin (0.4V), I'd have a 90% guess that there is a short circuit involved. It could be the GPIO output of the ARM enabled and driving that pin to GND. I'd try to measure the current flowing into the ARM input pin.

\$\endgroup\$
1
\$\begingroup\$

I am again amazed by myself. The same pin has been configured as a digital push-pull somewhere else in code, but no longer used by this module. This code has been present for over a year, but since it probably always have been initialized before the ADC, the ADC have been overwriting the pin configuration and everything has been working fine. This was until the ADC initialization had been moved and done before the other configuration, making the ADC configuration overwritten as a digital input push-pull. I wish to thank all for the great help and input and their time.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.