Help Adapt LM4562 for KiCad Simulation

I am trying to configure TI LM4562 model for the KiCad Spice simulator
using the TL072 as a template. The TL072 version is from tutorials
and they work. But the TL072 is a simple macromodel, the LM4562 is
more complex with different subckt structures.

Advice for mapping the LM4562 pins would be appreciated.

*  -------- snippets from SPICE models for opamps ---------------
* file: TL072-dual.lib
* A dual opamp ngspice model
.subckt TL072c 1out 1in- 1in+ vcc- 2in+ 2in- 2out vcc+
.include TL072.301
XU1A 1in+ 1in- vcc+ vcc- 1out TL072
XU1B 2in+ 2in- vcc+ vcc- 2out TL072
.ends

.................
* file: TL072.301
* TL072 OPERATIONAL AMPLIFIER "MACROMODEL" SUBCIRCUIT
* CREATED USING PARTS RELEASE 4.01 ON 06/16/89 AT 13:08
* (REV N/A)      SUPPLY VOLTAGE: +/-15V
* CONNECTIONS:   NON-INVERTING INPUT
*                | INVERTING INPUT
*                | | POSITIVE POWER SUPPLY
*                | | | NEGATIVE POWER SUPPLY
*                | | | | OUTPUT
*                | | | | |
.SUBCKT TL072    1 2 3 4 5
*
  C1   11 12 3.498E-12
  C2    6  7 15.00E-12
... truncated


........................
file: LM4562.lib

.SUBCKT LM4562 Vinm Vinp VCC VEE Vout
X1 VCC VEE Vinp Vinm Vout AMP
.ENDS

.SUBCKT AMP VDD VSS VIP VIM VO

Iq          VDD VSS 5E-3
IS2         VDD 6 -15.5E-9
IS3         5 VSS 4.5E-9
... truncated

I am using KiCad 9.0.3 on Xubuntu.

I put some “preformatted text” (triple back ticks) in your post to make the posted snippets more readable. You can find these (and more) in the “menu bar” when you’re typing a post.

I don’t think that matters. For ngSpice (The simulator in KiCad) they are just subcircuits, and complexity of their internals has nothing at all to do with pin mapping.

So far, I have found that TL072 opamp works as described in the tutorial. The LM4562 and NE/NJM-5532 are not usable. For example, pin 3 of the 5532 shows 30vdc while the power supply is ±15. The input signal is distorted. The model is from s-audio.systems

I include a png of my audio project.

“Weird” issues with models are often caused by incorrect pin mapping between the schematic symbol and the spice model.

What’s wrong with the LM4562 spice model on their product page?

.SUBCKT LM4562 Vinm Vinp VCC VEE Vout

You see the difference?
Vinm → INVERTING INPUT
Vinp → NON-INVERTING INPUT

My suggestion (not tested!) for a model that fits to the 8-pin multi-part symbol of a dual opamp.

* file: LM4562-dual.lib
* A dual opamp ngspice model
* pin sequence 1 - 8 of the symbol
.subckt LM4562dual 1out 1in- 1in+ vcc- 2in+ 2in- 2out vcc+
.include LM4562.LIB
* pin sequence of the .subckt line in the vendor's model
* .SUBCKT LM4562 Vinm Vinp VCC VEE Vout
XU1A 1in- 1in+ vcc+ vcc- 1out LM4562
XU1B 2in- 2in+ vcc+ vcc- 2out LM4562
.ends

I’d like to recommend to run a simple test, if involving a new operational amplifier with a model downloaded from somewhere. This test checks if the model is compliant with KiCad/ngspice. It uses a 5-pin generic symbol and the vendor-supplied 5-pin models.

In the attached project (KiCad 9.0.3) there is a simple non-inverting amplifier with a gain of 2 and a sinewave input. The generic symbol with 5 pins is drawn from the Simulation_SPICE library. A generic model is intrinsically attached to this symbol.

As a first test you may run the op, ac, and tran simulations.

If you want to test another amplifier, do the following:
Download the model, put it into the project folder.
Attach the model to the symbol.
Take care of the pin sequence (obviously not all models have the same sequence.).
Run the simulations, check if they look similar to what obtained with the generic model.
OpAmpTest.7z (6.5 KB)

The LM4562 model is different then the TL072 version. These chips have identical pins so I am surprised to see an additional subckt and I don’t understand. Perhaps I should test it as a 5pin version…

Pins 2 and 3 are swapped compared to TL072, TL082, and NE5532. Is that intentional.
According to chatGPT, LTSpice and TINA simulators silently update the 5pin models to 8pin. This means duplication of effort because everybody has to invent fixes for these incomplete models. Just saying.

Have you also asked your chatbox who and why swapped those pins?

Both me and Holger gave you pretty good hints about the problem, then your chatbox apparently suggest the same, and that is apparently still not enough to change two pin numbers.

Just saying. (Whatever that is supposed to mean).

I am pretty sure chatGPT is mistaken here. LTSpice simply uses the spice model and is usually unaware of the real physical package. E.g. the TI model for the TL072 only represents one of the op-amps inside the package. Since LTSpice doesn’t care about the real package one simply adds this op-amp model however often it is needed to the LTSpice circuit. Kicad circuits represent real devices. So the nodes in the spice model have to be matched to the pins of the real physical device.

That’s simply wrong. In reality they don’t care about the 8 pins of a real footprint. They use the 5-node model with a 5-pin symbol (pin stands for electrical node, not a real solderable pin). And if you want to simulate the two opamps in LTSPICE, you have to place 2 symbols with 5 pins each.

Hi Lucas, sort of double answer.

1 Like

According to chatGPT

You cannot just use ChatGPT and be taken seriously. You must always follow up on a ChatGPT query with further research of your own to verify the answer. This is true in general, but non-trivial electronics-related LLM spew in particular should always be assumed to be of negative value until proven otherwise.

EDA tools are notoriously hard to find information on, because it’s either horribly out-of-date, undocumented, or locked away in company knowledge bases, the brains of the senior engineers and behind vendor forum login walls, which often require a subscription. In addition this lack of good information means they are frequently misunderstood and so there are very many outright wrong answers on forums that go unchallenged and just sit there for decades. There are also many discussions with just problem statements, often with mistaken assumptions and no answers or corrections. LLMs are also poor at handling things like part numbers as they tend to appear statistically linguistically interchangeable, but are very much not interchangeable in the real world.

This used to just make it hard to find information via Google. Now, it means that LLMs will also fail to find true information in their training data and via their own searching, also ingest a lot of wrong information and then they’ll often make something plausible-sounding up.

Now, ChatGPT may indeed be able to magic up a good answer and give you the keywords and even links to go and verify it. In fact it’s extremely good at it, and using it is a fine idea. But you have to then do the verification bit. Every time, personally, and before you dump the quantum answer-hallicination superposition on forums for others to verify or debunk for you.


As for the pin mapping, it’s very normal that the model doesn’t have the same signal ordering as the physical components. In fact it’s pretty unusual for it to match, and also usual that it nearly matches. You have to remap the signal here to match the model to the pins on the KiCad symbol

image

2 Likes

If you are having convergence problems, you might add 10 megohm or feedback around the op amp so dc settles better. You could also temporarily try connecting R4 to the opamp output instead of the FB node to see if that works first.

1