I have a PIC18F46K80 microcontroller. The ADC input is connected with OPAMP TL064I output through a 2.2k resistor and Schottky diodes in the ADC input as in the figure.

Part of schematic showing Op-Amp connection to MCU ADC input

I have changed a capacitor C1 in the power supply circuit of this project from 1000uF to 220uF has a voltage of -20V which drives the -12V (VCC-) of the OPAMP.

I have noticed that when the power go OFF while using the 220uF capacitor it discharges faster and the OPAMP output become small but positive (about +300mV) and decay slowly. If the power come back again while this signal (+300mV) is in the OPAMP output (the ADC input); the reading from the ADC gives constant (most of the time is 0) value, despite the signal being 50Hz sinewave.

If I made a software reset or wait for long time before reconnecting the power (until the OPAMP signal become small; less than +200mV, or discharge power supply capacitors by hand), the ADC works properly.

enter image description here

The old design uses a 1000uF in the -20V supply (which discharge slower than the 220uF), and when the power go OFF the OPAMP output goes negative in very short time.

enter image description here

This didn’t occur in every board that I have tested. It occurred in 4 out of 10 boards.

I have assembled these boards in a small SMT assembly factory in Shenzhen. I have noticed that they don’t have a grounded floor and they have only one reflow oven, so they have to put the assembled board in a metal tray to put it by hand in the oven.

I am wondering if this issue is inherit to the ADC operation when transients occur? (Though there are Schottky with resistor!)

Or, could it be ESD damage caused by poor handling in the SMT factory? (other functions by the microcontroller operate correctly!)

As requested in comments, here is the external MCLR circuit:

Part of the schematic showing external MCLR

  • \$\begingroup\$ What does the PIC reset circuit look like? \$\endgroup\$ Dec 18 '17 at 9:58
  • \$\begingroup\$ It is a software reset I just call a reset_cpu(); function. \$\endgroup\$ Dec 18 '17 at 11:09
  • \$\begingroup\$ Or you want me to look into the datasheet for the circuit inside the PIC? \$\endgroup\$ Dec 18 '17 at 11:11
  • \$\begingroup\$ Or you mean the external MCLR pin circuit? \$\endgroup\$ Dec 18 '17 at 11:25
  • \$\begingroup\$ Yes, the external power-on reset circuit, if any. \$\endgroup\$ Dec 18 '17 at 11:40

I think your problem is probably the reset circuit, since resetting the MCU restores operation. If the microcontroller is improperly reset at power-up there is no guarantee of proper operation and the exact effects may vary from unit to unit.

The clamp Schottky diodes allow the op-amp to hold the power up and reducing the negative rail filter cap means that the op-amp output will likely hold the Vdd on the micro above the guaranteed reset zone longer than if the negative rail cap was larger.

enter image description here

If you don't ensure the supply voltage drops below 700mV and rises faster than 50mV/second, the reset is not guaranteed.

It is most reliable to use an external reset IC which guarantees a minimum reset pulse width of perhaps 200ms and properly handles all combinations of short and long interruptions of power or brownouts, but the internal BOR may well work for you if you enable it, particularly at 5V.

As a quick fix, you can hang a resistor of maybe 1K across the Vdd to GND, which will discharge the power supply relatively quickly.

  • 1
    \$\begingroup\$ I will enable the BOR for now. 1K across Vdd to GND will affect the operation of the circuit, power is very limited. I will read more about the reset. Thank you. \$\endgroup\$ Dec 18 '17 at 13:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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