I am simulating a simple constant-current source using LTSpice:

Constant-current source made from MAX44250 controlling 2N7002 MOSFET gate.

In simulation and on the breadboard, this works as expected: U1 controls the M1 gate voltage, the voltage across R1 is a constant 5 V, and thus the current through D4 is 100 mA.

But it turns out the actual LED I'll need to drive has its cathode tied to chassis ground; the load must be on the low side. I simulated two different circuits: the pMOS dual (with negative-terminal feedback, 2), and an nMOS circuit with positive-terminal feedback (3). Both options are stable and maintain an average current of 100 mA through the load.

Two more constant-current sources, now with low-side loads.

However, despite meeting stability criteria, the nMOS circuit has a 20 MHz oscillation, 8 mA pk-pk, driven by an oscillating voltage at the output of the op-amp. (~45 mV pk-pk.)

Simulation shown below; top graph in red shows \$V_{GS}\$ across M3, middle (blue) shows current through the nMOS-driven load, bottom (teal) shows the pMOS circuit behaving as expected.

M3 gate-source voltage, current through nMOS, current through pMOS.

Some further information: the MAX44250 is a chip I've used before in other DC-gain applications. It is a unity-gain-stable precision op amp, and chosen in part because Maxim provides an actually-functional high-quality SPICE model. Running simulations with other (LTSpice-provided) op-amps produce results that are unstable and/or nonsensical. (The MAX44241, for example, outputs 0 V despite a V+ of 12 V and a V- of 5 V.)

My question: what's causing this oscillation? Why does positive feedback from the high side of an nMOS cause oscillation, when negative feedback on the low side of a pMOS is rock-solid? Why does it completely break the MAX44241? Are there any tricks to eliminate or compensate for this oscillation, or are there fundamental reasons beyond open-loop gain that make this circuit oscillate?

  • \$\begingroup\$ I don't see any bypass capacitor across the power supply. \$\endgroup\$ Commented Dec 31, 2022 at 22:53
  • \$\begingroup\$ "Despite meeting stability criteria" -- what stability criteria? \$\endgroup\$
    – TimWescott
    Commented Dec 31, 2022 at 23:19
  • 3
    \$\begingroup\$ Your circuits #2 & #3 are not constant-current sources as they depend on your 12V supply being stable (whereas circuit #1 does not). If your 12V supply is stable, then the opamp & MOSFET are superfluous. \$\endgroup\$
    – brhans
    Commented Jan 1, 2023 at 1:26
  • 1
    \$\begingroup\$ Yes - if the 5V level is referenced to 12V and not to 0V, then #2 & #3 will be constant-current. \$\endgroup\$
    – brhans
    Commented Jan 1, 2023 at 1:32
  • 1
    \$\begingroup\$ As Kevin White writes the large gate capacity (some times in nF range) can induce oscillations due to the loading of the driver and spurious inductances. To mitigate this it is common to add a small valued series resistor between the gate and driver output. Few ohms are often sufficient and are best found by experiments on the final circuits. \$\endgroup\$
    – helarsen
    Commented Feb 15 at 20:26

2 Answers 2


In (1) you have a source follower and this means that the MOSFET provides no extra gain that might cause the op-amp to become unstable when negative feedback is applied.

In (2) you have a source follower and this means that the MOSFET provides no extra gain that might cause the op-amp to become unstable when negative feedback is applied.

In (3) you have a common source MOSFET that will have shed-loads of voltage gain and will inevitably cause oscillation when the feedback loop is closed.

Why does positive feedback from the high side of an nMOS cause oscillation

Actually it's negative feedback at DC and low to middling frequencies but, inevitably the extra gain is going to tip the balance good and proper. The LED has a dynamic resistance of a few ohms and the drain has 70 ohms; maybe an added voltage gain of 25 times. Do you think op-amps are designed with this much spare margin to cope with a gain of maybe 25 times within the feedback loop?

Extra questions answered in comments

I don't understand why the gain is dependent on the ratio of source and drain resistance

M3 has gain due to the very small dynamic source resistance (circa 3 ohm from the LED) and, the 70 ohm in the drain. Given that source and drain currents are virtually the same, a signal voltage on the source will be magnified on the drain by 70/3 = ~25. Then, because the source signal voltage is roughly what the gate signal voltage is, you get a gain of circa 25 from gate to drain. And paraphrased later: -

For both a BJT and a MOSFET, the collector/drain current pretty much equals the emitter/source current and, because the signal at the gate/base is pretty much the same as that seen at the source/emitter, the magnitude of the signal at the collector/drain is higher by the ratio of drain resistor to source resistor. Gain approximates to \$R_D/R_S\$ and with an LED in the source the dynamic resistance will be a few ohms.

Whether it's a quirk of the discrete nature of the sim itself or there's some source of noise in the model that I don't see, or something else entirely-- even if it's a bad design with gain in the loop, the oscillation still needs to start somewhere, no?


Even if it's unstable, surely it needs some initial perturbation to start the oscillation? Like an inverted pendulum or a ball on top of a hill -- it can hold its position forever in a motionless vacuum, even if the slightest nudge will cause it to fall.

The very act of a simulation circuit being activated will cause power supply transients to initiate oscillation hence, we can use simulators for designing oscillators (and I have done so many times). There is one pre-condition though; you must prevent the simulator trying to calculate DC conditions first because, that can stop the transient condition triggering oscillation. You may have heard that simulators don't work with oscillators but, that is largely untrue. Simulators are pretty decent these days providing you use them properly.

Is there some feature of the simulation algorithm that intentionally adds perturbations to check for metastability?

Metastability is a digital phenomenon and isn't related to this question.

A simulator (when used appropriately) instantly applies voltages to the circuit. This transient is enough to begin the process of oscillation.

I'd like to also understand what is underlying not just the oscillation but why it's not getting to the rails. Is it reasonable to conceptualize this as analogous to a PID loop? If the Kp is way too high, I'd expect it to hit the rails; is there some component doing derivative operation to limit the swing?

Because the gain is on the cusp of "enough" and, usually, in so-called linear circuits, they behave not so linearly closer to the power rails and, the gain reduces. Nothing to do with PID controllers. No derivate just soft clipping leading to hard clipping.

  • 1
    \$\begingroup\$ Actually, given that the Si4403DY has a gate-source capacitance (inferred from the G-S charge at \$\mathrm{V_{GS}} = -5V\$) of roughly \$1 \mathrm{nF}\$, I'm surprised that (2) is stable. Usually even a source-follower configuration like this needs some external compensation. \$\endgroup\$
    – TimWescott
    Commented Dec 31, 2022 at 23:32
  • \$\begingroup\$ When I breadboarded it, I used some variety of a ZVP -- I think the 4525. (I don't have a SPICE model for it, though.) I used a 3R resistor in lieu of an LED, but the current through it was steady. \$\endgroup\$
    – Matt S
    Commented Dec 31, 2022 at 23:58
  • 1
    \$\begingroup\$ @MattS --> What should I do when someone answers my question \$\endgroup\$
    – Andy aka
    Commented Feb 28, 2023 at 11:27
  • 1
    \$\begingroup\$ @MattS let me also remind you of your question: My question: what's causing this oscillation? <-- let me also remind you that we have sauntered a long way now and we are being reminded that our discussion in comments is too long. I might also add that raising a brand new question to get confirmation of what has been said in comments is a reasonable thing to do. \$\endgroup\$
    – Andy aka
    Commented Mar 1, 2023 at 15:49
  • 1
    \$\begingroup\$ Metastability. (and not metastability). In other words: will remain stationary without an applied force, but a small applied force will push it towards a more-stable point. Like the inverted pendulum or the ball on top of a hill. \$\endgroup\$
    – Matt S
    Commented Mar 1, 2023 at 16:59

The MAX44250 does not have rail-to-rail input so won't work without restrictions in circuit 2 or 3. The Spice model may not be good enough to detect that.

For circuit 2 you need an opamp that can work with the inputs at the positive supply rail. Also the input voltage has to be referenced to the positive supply rail which is inconvenient in most circuits.

As Andy indicates the extra gain from the MOSFET will almost certainly cause instability for circuit 3. You need to reduce the gain around the loop or provide a compensation network in the loop to make it stable. One arrangement would be to provide a capacitative coupling from the opamp output to the inverting input.

It is common that circuits such as figure 1 are unstable because of the input capacitance of the MOSFET in conjunction with the output resistance of the amplifier adds phase shift that cause instability. Again a common solution is with a capacitor from the amp output to the inverting input with a resistor from the current sense (R1) to the inverting input to provide the DC feedback.

Edit regarding common-mode range.

From the data sheet at [Max 44250 datasheet][1] [![Common-mode range][2]][2] the inputs are only allowed within 1.5V of the supply rail. It does not have a rail-to-rail input capability.

However if the set current is more than ~25mA, which it is in this case, then the circuit would work. It would not function correctly if you attempted to reduce the current to zero by changing the input voltage.

Also the set current depends on the difference between the 5V input and the 12V supply, not on the value of the 5V supply relative to ground. If either voltage changes the LED current will vary.

If a zener diode is used to provide the reference I would connect one end to the +12V rail with the other being fed from a current defining resistor to ground - that way the LED current defining voltage is referenced to the 12V supply and will be independent of the 12V supply. The sense resistor would need reducing to 50 ohm to set 100mA through the LED. [1]: https://www.mouser.com/datasheet/2/256/MAX44250-MAX44252-179889.pdf [2]: https://i.sstatic.net/R9uby.png

  • \$\begingroup\$ The MAX44250 does have rail-to-rail inputs, according to its datasheet. But all three circuits have 5 V at the input and a 12 V power supply -- in theory, when controlling the load the inputs should be far from the rails. On the breadboard I just used a 5.1 V zener as a reference. \$\endgroup\$
    – Matt S
    Commented Dec 31, 2022 at 23:14
  • \$\begingroup\$ Oh, I misread it, thanks for the datasheet link! Yes, the zener needs a current limiting resistor and was chosen to make the 5V reference independent of the 12V supply. \$\endgroup\$
    – Matt S
    Commented Dec 31, 2022 at 23:41
  • \$\begingroup\$ @MattS - did you connect it to the 12V rail? Your schematic is slightly incorrect - I would define it in simulation by putting the positive terminal of V2 to the 12V rail and feeding the negative input into the opamp. \$\endgroup\$ Commented Dec 31, 2022 at 23:50
  • \$\begingroup\$ No, the setpoint voltage is a steady 5 V (ideal voltage source) in all three simulations. \$\endgroup\$
    – Matt S
    Commented Dec 31, 2022 at 23:54
  • 1
    \$\begingroup\$ @MattS - that was why I was suggesting you make it referenced to the 12V rail if you use circuit 2 or 3. On those two the sense resistor is connected to the 12V rail. \$\endgroup\$ Commented Jan 1, 2023 at 0:02

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.