Is there a way to solve the issue of dynamic gmin ...
# analog-design
j
Is there a way to solve the issue of dynamic gmin stepping failed?
t
There are many ways to solve it, but it is just a matter of ngspice failing to converge, and the problem can have any one of a number of sources. Often there is a "singular matrix" warning near the beginning of the simulation which can give a clue about what in the circuit ngspice is struggling with. Otherwise, altering the minimum time step or altering options like RELTOL or ABSTOL, or switching from the sparse matrix solver to the KLU solver, can help get around some issues. If it is a real circuit problem, then no amount of twiddling with options is going to do much.
j
Im trying to simulate BGR Temperature sweep and I am encountering this problem. I even tried to manually set gmin and set the node at 0.75V still Im facing issues.
r
Try this:
.option rshunt=1e9
j
Didnt make much changes, I did change gmin=1n, and set v(p1)=0.75. I got the same result
r
It’s better
Try rshunt=1e8
j
It worsens it
r
Another way is to add a startup circuit, run a transient sim, let it settle and check the voltage. It can be coded in .control inside a loop.
j
@Stefan Schippers Can you pls help
t
As Robin indicated, bandgap reference circuits are notorious for having bistable states. That makes a DC sweep difficult for a simulator, because it cannot tell what operating point the circuit is supposed to be in, and it can either get the wrong operating point or just fail to converge to a solution. One way to get around that problem is to do a transient simulation instead of a DC sweep. Make sure you have a startup circuit on your bandgap to ensure that the bandgap powers up into the correct state, then run a transient simulation to get the bandgap into that state, and then measure the DC value you want from the transient output.
s
@Jnanapurushothama
.option gmin=5n
I commented the above line and I got a reasonable operating point. Remember that bandgaps need always a startup circuit, because there is a metastable state with nA of currents and extremely low biasing. You need to jump to the stable operating point with forward biased diode connected PNPs. Without a startup circuit the bandgap takes a very long time to startup, and if OTA offset is of the wrong side may never turn on. For the same reason ngspice has trouble converging to the right operating point.
I have edited the schematic to obtain reasonable values. The
Vref
voltage is in accordance with theory, in a temperature sweep.
Vref = kT/q *ln(8) * R10 / R7
Attached modified schematics
j
The Opamp is a low headroom OTA it cant handle inputs of 0.7 its max icm voltage is 0.45 thats why I was using that resistor divider to add Ictat and also such that ota sees 0.35 instead of 0.7. My specification has very stringe requirement of min VDD=1.65V
s
I resized a bit the input pair, and it seems with 0.7V CM input there is still headroom at 1.65Vcc . Also replaced with LVT the p-ch current sources. But I only wanted to see if there was something else preventing correct simulation. not proposing a different solution.
👍 1
j
Can you pls share the sch file of this. Also I was able to get the correct results without any issues for my circuit in cadence, I dont know why I'm facing this issue just in ngspice. I have not studied how to implement startup circuit yet. I tried to implement a simple one but that didnt solve the convergence issue either in ngspice
s
@Jnanapurushothama I uploaded all the xschem files some comments above...
@Jnanapurushothama also consider that a bandgap works by injecting current into a single PNP diode and the same current into a multiple (in your case m=8) diode with a series resistance. Diode current equations show that the voltage difference on the series resistance (
R7
) is a PTAT (Proportional To Absolute Temperature),
V=kT/q * ln(8)
, so the current is
kT/q*ln(8)/R7
the same current is mirrored into a resistor
R10
to get the
Vref
voltage However if you put resistive voltage dividers in parallel to the PNP diodes the current in the two branches will be
kT/q*ln(8)/R7 + Vbe/(R12 + R11)
and
kT/q*ln(8)/R7 + Vbe2 / (R3 + R6)
(the two currents will be equal due to the current mirrors). So the
Vref
voltage will be:
[ kT/q*ln(8)/R7 + Vbe2 / (R3 + R6) ] * R10
This is no more a PTAT voltage since you get the temperature dependence of a Vbe and of the resistors.
j
Yes, this a version of sub1V BGR where instead of pushing Iptat to some resistor and a diode and generating the vref, we generate temp independent current itself this has problem of being bit more erroneous than normal bgr since ictat is vbe/R3+R6. I used this since my spec was for sub1V BGR