My circuit works sometime ,sometime not.

Help
lpc2138
2013-03-27
2013-06-12
  • lpc2138
    lpc2138
    2013-03-27

    my schematic
    spice netlist

    NE555  Timer as Astable Multivibrator
    .tran 2u 1m 0
    XU1 GND VVV111 VOUT R1_2 XU1_5 VVV111 XU1_7 R1_2 555
    V1 R1_2 GND  5
    R3 GND VOUT  2K
    R2 VVV111 XU1_7  1K
    R1 XU1_7 R1_2  100
    C1 GND VVV111  100NF
    .save V(VOUT) V(VVV111) 
    .subckt 555 1 2 3 4 5 6 7 8
    x1       1  2  3  4  5  6  7  8  B 1502_x
    r1   8   5  ires_p 450K
    r2   5   B  ires_p 450K
    r3   B   1  ires_p 450K
    c1   5   8  4.6p
    c2   B   8  4.6p
    .model ires_p RES R=1
    .ends 555
    * connections:   gnd (global common 0 )
    *                |  trigger
    *                |  |  output
    *                |  |  |  reset
    *                |  |  |  |  control
    *                |  |  |  |  |  threshold
    *                |  |  |  |  |  |  discharge
    *                |  |  |  |  |  |  |  vcc supply
    *                |  |  |  |  |  |  |  |  |-bias input
    .subckt  1502_x  1  2  3  4  5  6  7  8  14
    *
    * trigger comparator
    mp1  19   2  13   8 pch w=240u l=9u
    mp2  15  14  13   8 pch w=240u l=9u
    mn3  15  15   1   1 nch w=120u l=11u
    mn4  19  15   1   1 nch w=120u l=11u
    * reset logic
    mn5  19  18   1   1 nch w=80.u l=6u  
    mn6  18   4   1   1 nch w=80.u l=6u
    mn7  20  19   1   1 nch w=80.u l=6u  
    qt9   8  18  20   8 bn
    mn8  21  20   1   1 nch w=80.u l=6u 
    mp10 21  20   8   8 pch w=200u l=6u 
    mn11 22  21   1   1 nch w=560u l=6u 
    mp12 22  21   8   8 pch w=1400u l=6u 
    mn13 20  21   1   1 nch w=5.9u  l=30.u 
    mp14 20  21   8   8 pch w=5.9u  l=10u 
    mp15 20  23   8   8 pch w=88u   l=6u  
    *
    * output stage
    mp16  3  22   8   8 pch w=720u l=6u 
    mn17  3  22   1   1 nch w=2800u l=6u 
    mn18  7  22   1   1 nch w=8400u l=6u 
    *
    * threshold comparator
    mn19  23   6  10  10 nch w=240u l=11u 
    mn20   9   5  10  10 nch w=240u l=11u 
    mp21   9   9   8   8 pch w=134u  l=9u 
    mp22  23   9   8   8 pch w=134u  l=9u 
    *
    *bias current
    r18   18   8   100K
    i10   10   1   15u
    i13   13   8   -5u
    * capacitors
    c09    9   1  0.1p
    c10   10   1  0.1p
    c15   15   1  0.1p
    c18   18   1  0.1p
    c19   19   1  0.1p
    c20   20   1  0.08p
    c21   21   1  0.1p
    c22   22   1  0.2p
    c23   23   1  0.12p
    ** Added by SIMetrix Technologies Ltd
    ** Without this, convergence is difficult if the output is 
    ** left open circuit
    Cout 3 1 0.1p
    *
    .model bn npn (bf=100 va=200 cje=4p cjc=5p cjs=5p tf=1.4n
    +              tr=200n rb=1000 rc=3000 re=20 ikr=100u is=4e-16)
    *
    ** Added by SIMetrix Technologies Ltd - CGDO parameter to help convergence.
    ** Value used is much lower than is likely for real device
    .model nch nmos (level=1 VTO={0.6*UNIF(0.03)} TOX=.055u UO=600  
    +                LAMBDA=.05 GAMMA=1.1 RD=7 RS=7 CGDO=1e-10)
    .model pch pmos (level=1 VTO={-0.7*UNIF(0.03)} TOX=.055u UO=260  
    +                LAMBDA=.06 GAMMA=.58 RD=14 RS=14 CGDO=1e-10)
    .ends
    .END
    

    when it does not work. the error message like this.

    Error on line 0 : r.xu1.r1 r1_2 xu1_5 xu1:ires_p 450k 
     unknown parameter (xu1:ires_p) 
    Error on line 0 : r.xu1.r2 xu1_5 xu1.b xu1:ires_p 450k 
     unknown parameter (xu1:ires_p) 
    Error on line 0 : r.xu1.r3 xu1.b 0 xu1:ires_p 450k 
     unknown parameter (xu1:ires_p) 
    Model issue on line 0 : .model xu1:ires_p res r=1 ...
    Unknown model type res - ignored
    ASCII raw file
    Doing analysis at TEMP = 27.000000 and TNOM = 27.000000
    Warning: r.xu1.r3: resistance = 0 ohm, set to 1000 ohm
    Warning: r.xu1.r2: resistance = 0 ohm, set to 1000 ohm
    Warning: r.xu1.r1: resistance = 0 ohm, set to 1000 ohm
    No. of Data Columns : 3  
    Note: Starting dynamic gmin stepping
    Trying gmin =  1.0000E-003 Note: One successful gmin step
    Trying gmin =  1.0000E-004 Note: One successful gmin step
    Trying gmin =  1.0000E-005 Warning: Further gmin increment
    Trying gmin =  5.6234E-005 Note: One successful gmin step
    Trying gmin =  2.3714E-005 Warning: Further gmin increment
    Trying gmin =  4.5316E-005 Note: One successful gmin step
    Trying gmin =  3.2781E-005 Warning: Further gmin increment
    Trying gmin =  4.1792E-005 Note: One successful gmin step
    Trying gmin =  3.7013E-005 Note: One successful gmin step
    Trying gmin =  3.0850E-005 Note: One successful gmin step
    Trying gmin =  2.3475E-005 Note: One successful gmin step
    Trying gmin =  1.5582E-005 Note: One successful gmin step
    Trying gmin =  8.4267E-006 Note: One successful gmin step
    Trying gmin =  3.3513E-006 Note: One successful gmin step
    Trying gmin =  8.4049E-007 Note: One successful gmin step
    Trying gmin =  1.0556E-007 Warning: Further gmin increment
    Trying gmin =  5.0035E-007 Note: One successful gmin step
    Trying gmin =  2.2982E-007 Note: One successful gmin step
    Trying gmin =  1.0556E-007 Warning: Further gmin increment
    Trying gmin =  1.8920E-007 Note: One successful gmin step
    Trying gmin =  1.4133E-007 Note: One successful gmin step
    Trying gmin =  9.1235E-008 Warning: Further gmin increment
    Trying gmin =  1.2668E-007 Note: One successful gmin step
    Trying gmin =  1.0751E-007 Warning: Further gmin increment
    Trying gmin =  1.2159E-007 Note: One successful gmin step
    Trying gmin =  1.1433E-007 Note: One successful gmin step
    Trying gmin =  1.0425E-007 Warning: Further gmin increment
    Trying gmin =  1.1172E-007 Note: One successful gmin step
    Trying gmin =  1.0792E-007 Warning: Further gmin increment
    Trying gmin =  1.1076E-007 Note: One successful gmin step
    Trying gmin =  1.0933E-007 Warning: Further gmin increment
    Trying gmin =  1.1040E-007 Note: One successful gmin step
    Trying gmin =  1.0986E-007 Warning: Further gmin increment
    Trying gmin =  1.1027E-007 Warning: Further gmin increment
    Trying gmin =  1.1037E-007 Note: One successful gmin step
    Trying gmin =  1.1032E-007 Warning: Further gmin increment
    Trying gmin =  1.1035E-007 Note: One successful gmin step
    Trying gmin =  1.1033E-007 Note: One successful gmin step
    Trying gmin =  1.1031E-007 Warning: Further gmin increment
    Trying gmin =  1.1033E-007 Note: One successful gmin step
    Trying gmin =  1.1032E-007 Warning: Further gmin increment
    Trying gmin =  1.1033E-007 Note: One successful gmin step
    Trying gmin =  1.1032E-007 Warning: Last gmin step failed
    Warning: Dynamic gmin stepping failed
    Note: Starting source stepping
    Supplies reduced to   0.0000% Note: One successful source step
    Supplies reduced to   0.1000% Note: One successful source step
    Supplies reduced to   0.2000% Note: One successful source step
    Supplies reduced to   0.3000% Note: One successful source step
    Supplies reduced to   0.4500% Note: One successful source step
    Supplies reduced to   0.6750% Note: One successful source step
    Supplies reduced to   1.0125% Note: One successful source step
    Supplies reduced to   1.5188% Note: One successful source step
    Supplies reduced to   2.2781% Note: One successful source step
    Supplies reduced to   3.4172% Note: One successful source step
    Supplies reduced to   5.1258% Note: One successful source step
    Supplies reduced to   7.6887% Note: One successful source step
    Supplies reduced to  11.5330% Note: One successful source step
    Supplies reduced to  15.3773% Note: One successful source step
    Supplies reduced to  21.1438% Note: One successful source step
    Supplies reduced to  29.7936% Supplies reduced to  21.1438% Note: One successful source step
    Supplies reduced to  22.1438% Note: One successful source step
    Supplies reduced to  23.6438% Note: One successful source step
    Supplies reduced to  25.8938% Note: One successful source step
    Supplies reduced to  29.2688% Supplies reduced to  25.8938% Note: One successful source step
    Supplies reduced to  26.4001% Note: One successful source step
    Supplies reduced to  27.1595% Note: One successful source step
    Supplies reduced to  28.2985% Supplies reduced to  27.1595% Note: One successful source step
    Supplies reduced to  27.3303% Note: One successful source step
    Supplies reduced to  27.5866% Note: One successful source step
    Supplies reduced to  27.9711% Supplies reduced to  27.5866% Note: One successful source step
    Supplies reduced to  27.6443% Supplies reduced to  27.5866% Note: One successful source step
    Supplies reduced to  27.5953% Note: One successful source step
    Supplies reduced to  27.6082% Note: One successful source step
    Supplies reduced to  27.6277% Note: One successful source step
    Supplies reduced to  27.6569% Supplies reduced to  27.6277% Note: One successful source step
    Supplies reduced to  27.6321% Supplies reduced to  27.6277% Note: One successful source step
    Supplies reduced to  27.6284% Note: One successful source step
    Supplies reduced to  27.6293% Note: One successful source step
    Supplies reduced to  27.6308% Note: One successful source step
    Supplies reduced to  27.6330% Supplies reduced to  27.6308% Note: One successful source step
    Supplies reduced to  27.6312% Supplies reduced to  27.6308% Note: One successful source step
    Supplies reduced to  27.6309% Note: One successful source step
    Supplies reduced to  27.6310% Note: One successful source step
    Supplies reduced to  27.6311% Note: One successful source step
    Supplies reduced to  27.6312% Supplies reduced to  27.6311% Note: One successful source step
    Supplies reduced to  27.6311% Note: One successful source step
    Supplies reduced to  27.6311% Note: One successful source step
    Supplies reduced to  27.6312% Warning: source stepping failed
    Transient solution failed -
    Last Node Voltages
    ------------------
    Node                                   Last Voltage        Previous Iter
    ----                                   ------------        -------------
    xu1.x1.19                                  0.684462             0.685232 *
    vvv111                                     0.460416             0.460416
    xu1.x1.13                                   1.23157              1.23157
    r1_2                                        1.38156              1.38156
    xu1.x1.15                                  0.618371             0.618371
    xu1.b                                      0.460519              0.46052
    xu1.x1.18                                 0.0346951             0.034695
    xu1.x1.20                                  0.712638             0.667579 *
    xu1.x1.21                              2.21975e-008          -0.00351476 *
    xu1.x1.22                                   1.38156              1.38156
    xu1.x1.23                                   1.38156              1.38156
    vout                                   1.14377e-010         1.14377e-010
    xu1_7                                      0.460416             0.460416
    xu1.x1.10                                  0.280273             0.280275
    xu1.x1.9                                   0.597705             0.597707
    xu1_5                                      0.921038             0.921039
    v1#branch                               -0.00968931          -0.00968926
    doAnalyses: Too many iterations without convergence
    

    thanks.

     
  • lpc2138
    lpc2138
    2013-03-27

     
  • lpc2138
    lpc2138
    2013-03-27

     
  • Holger Vogt
    Holger Vogt
    2013-03-27

    If you study the error messages, you will find:
    Unknown model type res - ignored
    ngspice does not know the model RES. If you study the manual (3.2.1) , you will find that the resistor model has to be called R, so the line in your input file reads
    .model ires_p R R=1

    Even then the operation point calculation does not converge. I get convergence if I add the line
    .options method=gear

    You may have a look at several inernet resources which deal with spice convergence issues. There seems to have been a convergence problem with the original (Simetrix) simulator as well (see comments in the input file).

    Regards

    Holger

     
  • Holger Vogt
    Holger Vogt
    2013-03-27

    A small update:

    In fact it is not about the simulation method.
    "My circuit works sometime ,sometime not" is untypical for any numerical solver which should give always the same result if the conditions are the same.
    Please read "your circuit" more carefully. You will find the line
    .model nch nmos (level=1 VTO={0.6*UNIF(0.03)} TOX=.055u UO=600 + LAMBDA=.05 GAMMA=1.1 RD=7 RS=7 CGDO=1e-10)
    which includes the function UNIF(…). Manual (2.8.5) shows that UNIF is a function delivering statistically distribute values. Your VTO thus varies from run to run, and sometimes the circuit converges, sometimes not, depending on its actual value.

    Holger