Headphone amp simulation

I tried to create an LTspice simulation of Jim Thompson's headphone amp (5/21/14 5:16 PM post). I got the supertex models from supertex.com and the TL082 model from TI. When run it produces the error message:

Fatal Error: Port(pin) count mismatch between the definition of subcircuit "tl082" and instance: "xu2" The instance has more connection terminals than the definition.

What have I got wrong?

Below is my netlist:

R1 out N001 50k R2 N001 N004 10k R3 0 out 32 R4 V- N006 6.8

V1 V+ 0 6 V2 0 V- 6 V3 in 0 SINE(0 0.2 1e3) M1 V+ N002 out N003 DN2540 M2 out V- N006 N005 DN2540 XU2 0 N001 V+ V- N002 TL082.lib TL082 .model NMOS NMOS .model PMOS PMOS .lib C:\Program Files\LTC\LTspiceIV\lib\cmp\standard.mos .lib C:\Program Files\LTC\LTspiceIV\lib\mylib\supertex.lib .tran 0.1 startup uic .lib C:\Program Files\LTC\LTspiceIV\lib\mylib\TL082.lib .backanno .end

Reply to
garyr
Loading thread data ...

TL082.lib has fewer connections than the opamp symbol you are using? (perhaps it's behavioral and lacks supply nodes or whatever) You'll have to look at the lib file..

Reply to
Johann Klammer

I finally discovered that a subcircuit is not the same as a model and needed to delete the reference to TL082.lib in the opamp instance and change .lib ...TL082.lib to .include ... TL082.lib. That solved the connection problem.

Now the simulation runs briefly and generates the error message:

Analysis: Time step too small; time = 2.58595e-006, timestep = 1.25e-019: trouble with u2:jx-instance j:u2:1

The netlist file is now 64 lines long. I tried to include it as a file but apparently that is not permitted. I'll post it if anyone is interested.

Reply to
garyr

Post your latest LTspice file as you did above. ...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    | 
| San Tan Valley, AZ 85142   Skype: Contacts Only  |             | 
| Voice:(480)460-2350  Fax: Available upon request |  Brass Rat  | 
| E-mail Icon at http://www.analog-innovations.com |    1962     | 
              
                        #BringBackOurBalls
Reply to
Jim Thompson

"ExpressPCB Netlist" "LTspice IV Version 4.18p"

1 0 0 "" "" "" "Part IDs Table" "R1" "50k" "" "R2" "10k" "" "R3" "32" "" "R4" "6.8" ""

"V1" "6" "" "V2" "6" "" "V3" "SINE(0 0.2 1e3)" "" "M1" "DN2540" "" "M2" "DN2540" "" "U2" "TL082" ""

"Net Names Table" "out" 1 "N001" 5 "N004" 8 "0" 10 "V-" 15 "N006" 19 "in" 21 "V+" 23 "N002" 26 "N003" 28 "N005" 29

"Net Connections Table"

1 1 1 2 1 3 2 3 1 9 3 4 1 10 1 0 2 1 2 6 2 2 1 7 2 11 2 0 3 2 2 9 3 5 1 0 4 3 1 11 4 6 2 12 4 7 1 13 4 8 2 14 4 11 1 0 5 4 1 16 5 7 2 17 5 10 2 18 5 11 4 0 6 4 2 20 6 10 3 0 7 5 2 22 7 8 1 0 8 6 1 24 8 9 1 25 8 11 3 0 9 9 2 27 9 11 5 0 10 9 4 0 11 10 4 0
Reply to
garyr

[snip]

That's not an LTspice .asc listing. It's a PCB layout format.

If you've drawn it in LTspice, you'll find a file *.asc... it's text... copy that text and post it here. ...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    | 
| San Tan Valley, AZ 85142   Skype: Contacts Only  |             | 
| Voice:(480)460-2350  Fax: Available upon request |  Brass Rat  | 
| E-mail Icon at http://www.analog-innovations.com |    1962     | 
              
                        #BringBackOurBalls
Reply to
Jim Thompson

[snip]

Version 4 SHEET 1 880 680 WIRE 0 144 -48 144 WIRE 160 160 64 160 WIRE 208 160 208 128 WIRE 0 176 -16 176 WIRE -16 208 -16 176 WIRE -512 240 -512 224 WIRE -512 240 -576 240 WIRE -576 256 -576 240 WIRE -512 288 -512 240 WIRE -240 288 -336 288 WIRE -144 288 -176 288 WIRE -48 288 -48 144 WIRE -48 288 -64 288 WIRE -16 288 -48 288 WIRE 208 288 208 176 WIRE 208 288 64 288 WIRE 368 288 208 288 WIRE -336 304 -336 288 WIRE 368 304 368 288 WIRE 208 320 208 288 WIRE 160 400 112 400 WIRE 208 400 208 368 WIRE 112 432 112 400 WIRE 208 432 208 416 FLAG -16 208 0 FLAG 368 384 0 FLAG -336 384 0 FLAG -576 256 0 FLAG -512 144 V+ FLAG 208 80 V+ FLAG 32 128 V+ FLAG -512 368 V- FLAG 32 192 V- FLAG 208 512 V- FLAG 112 432 V- FLAG 368 288 out FLAG -336 288 in SYMBOL res 80 272 R90 WINDOW 0 0 56 VBottom 2 WINDOW 3 32 56 VTop 2 SYMATTR InstName R1 SYMATTR Value 50k SYMBOL res -48 272 R90 WINDOW 0 0 56 VBottom 2 WINDOW 3 35 66 VTop 2 SYMATTR InstName R2 SYMATTR Value 10k SYMBOL res 384 400 R180 WINDOW 0 36 76 Left 2 WINDOW 3 36 40 Left 2 SYMATTR InstName R3 SYMATTR Value 32 SYMBOL res 224 528 R180 WINDOW 0 36 76 Left 2 WINDOW 3 36 40 Left 2 SYMATTR InstName R4 SYMATTR Value 6.8 SYMBOL cap -176 272 R90 WINDOW 0 0 32 VBottom 2 WINDOW 3 32 32 VTop 2 SYMATTR InstName C1

SYMBOL voltage -512 128 R0 WINDOW 123 0 0 Left 2 WINDOW 39 0 0 Left 2 SYMATTR InstName V1 SYMATTR Value 6 SYMBOL voltage -512 272 R0 WINDOW 123 0 0 Left 2 WINDOW 39 0 0 Left 2 SYMATTR InstName V2 SYMATTR Value 6 SYMBOL voltage -336 288 R0 WINDOW 123 24 124 Left 2 WINDOW 39 0 0 Left 2 WINDOW 3 38 72 Left 2 SYMATTR Value SINE(0 0.2 1e3) SYMATTR InstName V3 SYMBOL nmos4 160 80 R0 SYMATTR InstName M1 SYMATTR Value DN2540 SYMBOL nmos4 160 320 R0 SYMATTR InstName M2 SYMATTR Value DN2540 SYMBOL Opamps\\opamp2 32 96 R0 SYMATTR InstName U2 SYMATTR Value TL082 TEXT -536 496 Left 2 !.lib C:\\Program Files\\LTC\\LTspiceIV\\lib\\mylib\\supertex.lib TEXT -536 464 Left 2 !.tran 0.1 startup uic TEXT -536 528 Left 2 !.include C:\\Program Files\\LTC\\LTspiceIV\\lib\\mylib\\TL082.lib

Reply to
garyr

LTspice doesn't like those last "TEXT" lines, complaining of a syntax problem.

Anyone (everyone :-) more familiar with LTspice than me, how should those library calls be corrected? ...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    | 
| San Tan Valley, AZ 85142   Skype: Contacts Only  |             | 
| Voice:(480)460-2350  Fax: Available upon request |  Brass Rat  | 
| E-mail Icon at http://www.analog-innovations.com |    1962     | 
              
                        #BringBackOurBalls
Reply to
Jim Thompson

in

te

e:

ne

om

g?

d
e

le

ed.

I'm guessing that is just the line break in "Program files" make it single lines and it should work (if you have the libs in the same p lace)

-Lasse

Reply to
Lasse Langwadt Christensen
[snip]

I'm guessing that is just the line break in "Program files" make it single lines and it should work (if you have the libs in the same place)

-Lasse

I moved the lib files and get the same error. If I change the opamp to an LT1055 and delete the .include statement the simulation runs (the 3rd harmonic is -38 dB), so it would appear that the problem is with the TL082 subcircuit.

Netlist of TL082 version follows.

Version 4 SHEET 1 880 680 WIRE 0 144 -48 144 WIRE 160 160 64 160 WIRE 208 160 208 128 WIRE 0 176 -16 176 WIRE -16 208 -16 176 WIRE -512 240 -512 224 WIRE -512 240 -576 240 WIRE -576 256 -576 240 WIRE -512 288 -512 240 WIRE -240 288 -336 288 WIRE -144 288 -176 288 WIRE -48 288 -48 144 WIRE -48 288 -64 288 WIRE -16 288 -48 288 WIRE 208 288 208 176 WIRE 208 288 64 288 WIRE 368 288 208 288 WIRE -336 304 -336 288 WIRE 368 304 368 288 WIRE 208 320 208 288 WIRE 160 400 112 400 WIRE 208 400 208 368 WIRE 112 432 112 400 WIRE 208 432 208 416 FLAG -16 208 0 FLAG 368 384 0 FLAG -336 384 0 FLAG -576 256 0 FLAG -512 144 V+ FLAG 208 80 V+ FLAG 32 128 V+ FLAG -512 368 V- FLAG 32 192 V- FLAG 208 512 V- FLAG 112 432 V- FLAG 368 288 out FLAG -336 288 in SYMBOL res 80 272 R90 WINDOW 0 0 56 VBottom 2 WINDOW 3 32 56 VTop 2 SYMATTR InstName R1 SYMATTR Value 50k SYMBOL res -48 272 R90 WINDOW 0 0 56 VBottom 2 WINDOW 3 35 66 VTop 2 SYMATTR InstName R2 SYMATTR Value 10k SYMBOL res 384 400 R180 WINDOW 0 36 76 Left 2 WINDOW 3 36 40 Left 2 SYMATTR InstName R3 SYMATTR Value 32 SYMBOL res 224 528 R180 WINDOW 0 36 76 Left 2 WINDOW 3 36 40 Left 2 SYMATTR InstName R4 SYMATTR Value 6.8 SYMBOL cap -176 272 R90 WINDOW 0 0 32 VBottom 2 WINDOW 3 32 32 VTop 2 SYMATTR InstName C1

SYMBOL voltage -512 128 R0 WINDOW 123 0 0 Left 2 WINDOW 39 0 0 Left 2 SYMATTR InstName V1 SYMATTR Value 6 SYMBOL voltage -512 272 R0 WINDOW 123 0 0 Left 2 WINDOW 39 0 0 Left 2 SYMATTR InstName V2 SYMATTR Value 6 SYMBOL voltage -336 288 R0 WINDOW 123 24 124 Left 2 WINDOW 39 0 0 Left 2 WINDOW 3 38 72 Left 2 SYMATTR Value SINE(0 0.2 1e3) SYMATTR InstName V3 SYMBOL nmos4 160 80 R0 SYMATTR InstName M1 SYMATTR Value DN2540 SYMBOL nmos4 160 320 R0 SYMATTR InstName M2 SYMATTR Value DN2540 SYMBOL Opamps\\opamp2 32 96 R0 SYMATTR InstName U2 SYMATTR Value TL082 TEXT -536 496 Left 2 !.lib C:\\myLTClib\\DN2540.lib TEXT -536 464 Left 2 !.tran 0.1 startup uic TEXT -536 528 Left 2 !.include C:\\myLTClib\\TL082.lib

Reply to
garyr

I did this...

TEXT -536 496 Left 2 !.lib C:\PSpice\DeviceLib\Supertex\Supertex.lib TEXT -536 464 Left 2 !.tran 0.1 startup uic TEXT -536 528 Left 2 !.lib C:\PSpice\DeviceLib\Tx Timestep too small.

Looks like TI model is poorly crafted... which is not unusual. ...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    | 
| San Tan Valley, AZ 85142   Skype: Contacts Only  |             | 
| Voice:(480)460-2350  Fax: Available upon request |  Brass Rat  | 
| E-mail Icon at http://www.analog-innovations.com |    1962     | 
              
                        #BringBackOurBalls
Reply to
Jim Thompson

This runs quite nicely...

Version 4 SHEET 1 880 680 WIRE 0 144 -48 144 WIRE 160 160 64 160 WIRE 208 160 208 128 WIRE 0 176 -16 176 WIRE -16 208 -16 176 WIRE -512 240 -512 224 WIRE -512 240 -576 240 WIRE -576 256 -576 240 WIRE -512 288 -512 240 WIRE -240 288 -336 288 WIRE -144 288 -176 288 WIRE -48 288 -48 144 WIRE -48 288 -64 288 WIRE -16 288 -48 288 WIRE 208 288 208 176 WIRE 208 288 64 288 WIRE 368 288 208 288 WIRE -336 304 -336 288 WIRE 368 304 368 288 WIRE 208 320 208 288 WIRE 160 400 112 400 WIRE 208 400 208 368 WIRE 112 432 112 400 WIRE 208 432 208 416 FLAG -16 208 0 FLAG 368 384 0 FLAG -336 384 0 FLAG -576 256 0 FLAG -512 144 V+ FLAG 208 80 V+ FLAG 32 128 V+ FLAG -512 368 V- FLAG 32 192 V- FLAG 208 512 V- FLAG 112 432 V- FLAG 368 288 out FLAG -336 288 in SYMBOL res 80 272 R90 WINDOW 0 0 56 VBottom 2 WINDOW 3 32 56 VTop 2 SYMATTR InstName R1 SYMATTR Value 50k SYMBOL res -48 272 R90 WINDOW 0 0 56 VBottom 2 WINDOW 3 35 66 VTop 2 SYMATTR InstName R2 SYMATTR Value 10k SYMBOL res 384 400 R180 WINDOW 0 36 76 Left 2 WINDOW 3 36 40 Left 2 SYMATTR InstName R3 SYMATTR Value 32 SYMBOL res 224 528 R180 WINDOW 0 36 76 Left 2 WINDOW 3 36 40 Left 2 SYMATTR InstName R4 SYMATTR Value 6.8 SYMBOL cap -176 272 R90 WINDOW 0 0 32 VBottom 2 WINDOW 3 32 32 VTop 2 SYMATTR InstName C1

SYMBOL voltage -512 128 R0 WINDOW 123 0 0 Left 2 WINDOW 39 0 0 Left 2 SYMATTR InstName V1 SYMATTR Value 6 SYMBOL voltage -512 272 R0 WINDOW 123 0 0 Left 2 WINDOW 39 0 0 Left 2 SYMATTR InstName V2 SYMATTR Value 6 SYMBOL voltage -336 288 R0 WINDOW 123 24 124 Left 2 WINDOW 39 0 0 Left 2 WINDOW 3 38 72 Left 2 SYMATTR Value SINE(0 0.2 1e3) SYMATTR InstName V3 SYMBOL nmos4 160 80 R0 SYMATTR InstName M1 SYMATTR Value DN2540 SYMBOL nmos4 160 320 R0 SYMATTR InstName M2 SYMATTR Value DN2540 SYMBOL Opamps\\opamp2 32 96 R0 SYMATTR InstName U2 SYMATTR Value MyTL081 TEXT -536 496 Left 2 !.lib C:\\PSpice\\DeviceLib\\Supertex\\Supertex.lib TEXT -536 464 Left 2 !.tran 0.1 startup uic TEXT -536 528 Left 2 !.lib C:\PSpice\SymbolLib\mylib.lib

You'll need to change library calls and create library for MyTL081 (unwrap as neessary)...

******************************************************************
  • MyTL081 OPERATIONAL AMPLIFIER "MACROMODEL" SUBCIRCUIT (+/-15V)
**** .SUBCKT MyTL081 INP INN VCC VEE OUT .PARAM GDC=200K GBW=3 SLEW=13 ROUT=100 VP=14 VN=-14 PM=45 .PARAM PI=3.141593 PMR={PM/180*PI} GBR={GBW*1E6*2*PI} DELT={(90-PM)/90} .PARAM OMEGAZ={GBR/DELT} PROCPM={(1-TAN(PMR/2))/(1+TAN(PMR/2))} L={(PROCPM-DELT)/GBR/GBR/(PROCPM-(1/DELT))} .PARAM R={(1-OMEGAZ*OMEGAZ*L)/OMEGAZ} G1 0 N2 N1 0 1 G2 N2 0 N2 N3 1 R1 N3 OUTINT {ROUT} R2 N2 0 {GDC} R3 N5 N4 {R/(sqrt(L))} ;{R} E1 N3 0 VALUE {LIMIT(V(N2),{VN},{VP})} E2 N1 0 VALUE {LIMIT(V(N4),{-(SLEW)/(2*PI*GBW)},{SLEW/(2*PI*GBW)})} E3 N5 0 INP INN 1 RE3 N5 0 100K E4 0 N6 INP INN 1 RE4 N6 0 100K C1 0 N2 {1/(2*PI*GBW*1E6)} C2 N4 N7 {sqrt(L)} ;1 L1 N7 N6 {sqrt(L)} ;{L} DP OUTINT PDV D VFP PDV OUT 0 VFN OUT NDV 0 DN NDV OUTINT D FP VCC 0 VFP 1 FN 0 VEE VFN 1 IQ VCC VEE 1.4mA .MODEL D D .ENDS MyTL081 ******************************************************************

You will note that this model (created by Yours Truly :) has none of that polynomial nonsense. ...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    | 
| San Tan Valley, AZ 85142   Skype: Contacts Only  |             | 
| Voice:(480)460-2350  Fax: Available upon request |  Brass Rat  | 
| E-mail Icon at http://www.analog-innovations.com |    1962     | 
              
                        #BringBackOurBalls
Reply to
Jim Thompson
[snip]

Success using your subcircuit! Vout was 2 volts pp. The 2nd harmonic was -63 dB, the 3rd -45, all others below -65.I used Blackman-Harris weighting, transformed 1 second of data, 3-point binomial smoothing before windowing and FFT. Without smoothing the 2nd harmonic was -45 dB, the 3rd -51, all others below -65.

Reply to
garyr

[snip]

I'm trying to establish myself in the business of creating behavioral Spice models... models that work properly... _and_ match the real device and the datasheet.

Recently I successfully completed my first commercial behavioral modeling contract.... and I'm hoping for more... it's fun stuff ;-) ...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    | 
| San Tan Valley, AZ 85142   Skype: Contacts Only  |             | 
| Voice:(480)460-2350  Fax: Available upon request |  Brass Rat  | 
| E-mail Icon at http://www.analog-innovations.com |    1962     | 
              
                        #BringBackOurBalls
Reply to
Jim Thompson

[snip]

Many thanks for your help.

Reply to
garyr

[snip]

You are quite welcome! ...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    | 
| San Tan Valley, AZ 85142     Skype: skypeanalog  |             | 
| Voice:(480)460-2350  Fax: Available upon request |  Brass Rat  | 
| E-mail Icon at http://www.analog-innovations.com |    1962     | 
              
                        #BringBackOurBalls
Reply to
Jim Thompson

the

it

It is strange that none of the SPICE versions I have known and used(HSpice, NGSpice) do not handle polynomials very well. Now it appears that LTSpice suffers from the same disease.

Reply to
dakupoto

You might want to look into Verilog-AMS and on a higher level of abstraction SystemC-AMS.

Reply to
dakupoto

[snip]

Why? It won't run on any conventional simulator. ...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    | 
| San Tan Valley, AZ 85142     Skype: skypeanalog  |             | 
| Voice:(480)460-2350  Fax: Available upon request |  Brass Rat  | 
| E-mail Icon at http://www.analog-innovations.com |    1962     | 
              
                        #BringBackOurBalls
Reply to
Jim Thompson

[snip]

It think it's more like that the authors have no clue. There's nothing inherently wrong with a polynomial representation. ...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    | 
| San Tan Valley, AZ 85142     Skype: skypeanalog  |             | 
| Voice:(480)460-2350  Fax: Available upon request |  Brass Rat  | 
| E-mail Icon at http://www.analog-innovations.com |    1962     | 
              
                        #BringBackOurBalls
Reply to
Jim Thompson

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.