Spice issues with ST AmpOp model

Hi,
Using a Sallen-Key 2nd order low-pass filter, simulation works well with the TI LM324 model.
When using the ST TSX631 spice model, simulation failed. I am aware of the pin assignment as per the simulation model:
.SUBCKT TSX631 VP VM VCCP VCCN VS
to be aligned with the schematics.
The error given by Spice simulator:

Note: Compatibility modes selected: ps lt a
Circuit: KiCad schematic
Reducing trtol to 1 for xspice ‘A’ devices
Doing analysis at TEMP = 27.000000 and TNOM = 27.000000
Note: Starting dynamic gmin stepping
Trying gmin =   1.0000E-03 Warning: Further gmin increment
Trying gmin =   5.6234E-03 Warning: Further gmin increment
Trying gmin =   8.6596E-03 Warning: Further gmin increment
Trying gmin =   9.6466E-03 Warning: Further gmin increment

Trying gmin =   9.9996E-03 Warning: Last gmin step failed
Warning: True gmin stepping failed
Note: Starting source stepping
Supplies reduced to   0.0000% 
Trying gmin =   1.0000E-02 Warning: gmin step failed
Warning: source stepping failed
Note: Transient op started
Error: Transient op failed, timestep too small
AC operating point failed -
Last Node Voltages
—————————
Node                                   Last Voltage        Previous Iter
——                                   ——————        ——————
/vbat_adc                                       nan                  nan
probe_int_/vbatout_r4                           nan                  nan

v.xu1.v57#branch                                nan                  nan
r4#branch                                       nan                  nan
a$poly$e.xu1.e_ro1_voh#branch_1_0                    0                    0
a$poly$e.xu1.e_ro1_vol#branch_1_0                    0                    0
doAnalyses: AC:  Timestep too small; frequency = 0: trouble with xu1:diode_novd-instance d.xu1.d29
run simulation(s) aborted
Error: vector frequency not found!
Error: vector V(/VBat_ADC) not found!
Error: vector frequency not found!
Error: vector V(/VBat_ADC) not found!

Am I missing something simple ?
I can give details of the schematics, spice models and pin assignment if required.
Thanks for help

Application: KiCad x86_64 on x86_64
Version: 7.0.7, release build
Libraries:
	wxWidgets 3.2.2
	FreeType 2.13.0
	HarfBuzz 7.3.0
	FontConfig 2.14.2
	libcurl/7.88.1 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.11 nghttp2/1.51.0

Platform: macOS Ventura Version 13.4 (Build 22F66), 64 bit, Little endian, wxMac

Build Info:
	Date: Aug 14 2023 15:55:50
	wxWidgets: 3.2.2 (wchar_t,wx containers)
	Boost: 1.82.0
	OCC: 7.7.0
	Curl: 7.77.0
	ngspice: 38
	Compiler: Clang 13.0.0 with C++ ABI 1002

Build settings:
	KICAD_SPICE=ON

No problem to run this OpAmp (see project attached).
OpAmp-Test.7z (8.3 KB)

I opened the Opamp-Test project and it does not run from me. I get:

Background thread stopped with timeout = 0
No. of Data Rows : 0
Circuit: KiCad schematic
Error on line 0 :
a$poly$e.xu2.e_ro1_vol %vd [ /vcc /vee ] %vd ( xu2.ro1_vol 0 ) a$poly$e.xu2.e_ro1_vol
MIF-ERROR - unable to find definition of model a$poly$e.xu2.e_ro1_vol
Warning: Model issue on line 0 :
.model a$poly$e.xu2.e_ro1_vol spice2poly coef = [ 359.0289837257432 -99. ...
Unknown model type spice2poly - ignored
Error on line 0 :
a$poly$e.xu2.e_ro1_voh %vd [ /vcc /vee ] %vd ( xu2.ro1_voh 0 ) a$poly$e.xu2.e_ro1_voh
MIF-ERROR - unable to find definition of model a$poly$e.xu2.e_ro1_voh
Warning: Model issue on line 0 :
.model a$poly$e.xu2.e_ro1_voh spice2poly coef = [ 532.6471144805088 -139 ...
Unknown model type spice2poly - ignored
Reducing trtol to 1 for xspice 'A' devices
Doing analysis at TEMP = 27.000000 and TNOM = 27.000000
Warning: singular matrix:  check nodes xu2.ro1_vol and xu2.ro1_vol
Note: Starting dynamic gmin stepping
Trying gmin =   1.0000E-03 Warning: singular matrix:  check nodes xu2.ro1_vol and xu2.ro1_vol
Warning: Further gmin increment
Trying gmin =   5.6234E-03 Warning: singular matrix:  check nodes xu2.ro1_vol and xu2.ro1_vol
Warning: Further gmin increment
Trying gmin =   8.6596E-03 Warning: singular matrix:  check nodes xu2.ro1_vol and xu2.ro1_vol
Warning: Further gmin increment
Trying gmin =   9.6466E-03 Warning: singular matrix:  check nodes xu2.ro1_vol and xu2.ro1_vol
Warning: Further gmin increment
Trying gmin =   9.9105E-03 Warning: singular matrix:  check nodes xu2.ro1_vol and xu2.ro1_vol
Warning: Further gmin increment
Trying gmin =   9.9775E-03 Warning: singular matrix:  check nodes xu2.ro1_vol and xu2.ro1_vol
Warning: Further gmin increment
Trying gmin =   9.9944E-03 Warning: singular matrix:  check nodes xu2.ro1_vol and xu2.ro1_vol
Warning: Further gmin increment
Trying gmin =   9.9986E-03 Warning: singular matrix:  check nodes xu2.ro1_vol and xu2.ro1_vol
Warning: Further gmin increment
Trying gmin =   9.9996E-03 Warning: singular matrix:  check nodes xu2.ro1_vol and xu2.ro1_vol
Warning: Last gmin step failed
Warning: singular matrix:  check nodes xu2.ro1_vol and xu2.ro1_vol
Warning: Dynamic gmin stepping failed
Note: Starting source stepping
Supplies reduced to   0.0000% Warning: singular matrix:  check nodes xu2.ro1_vol and xu2.ro1_vol
Trying gmin =   1.0000E-02 Warning: singular matrix:  check nodes xu2.ro1_vol and xu2.ro1_vol
Warning: gmin step failed
Warning: source stepping failed
Transient solution failed -
Last Node Voltages
------------------
Node                                   Last Voltage        Previous Iter
----                                   ------------        -------------
out                                               0                    0
net-_u2--_                                        0                    0
xu2.vzout                                         0                    0
xu2.vo_diff_minus                                 0               -1e-14
xu2.vee_n                                         0               -2e-14
xu2.vccn_enhanced                                 0                4e-14
xu2.vo_diff_plus                                  0               -1e-14
xu2.net0283                                       0                    0
xu2.net0242                                       0                    0
xu2.net0244                                       0          0.000371766 *
xu2.vb                                            0                    0
xu2.net386                                        0                    0
xu2.net0280                                       0         -0.000371766 *
xu2.net0254                                       0                    0
xu2.net246                                        0                    0
xu2.net279                                        0            -0.544297 *
/vee                                              0                    0
xu2.net0341                                       0                    0
xu2.vccp_enhanced                                 0                    0
/vcc                                              0                    0
xu2.net256                                        0                    0
xu2.net257                                        0          0.000371766 *
xu2.net258                                        0             0.544297 *
xu2.net448                                        0                    0
xu2.net285                                        0         -0.000371766 *
xu2.net261                                        0                    0
xu2.net262                                        0             0.544297 *
xu2.net263                                        0                    0
xu2.net434                                        0                    0
xu2.net269                                        0            -0.544297 *
xu2.vb_3_sink                                     0             0.544297 *
xu2.vb_3                                          0                    0
xu2.vb_3_source                                   0            -0.544297 *
xu2.vzout_iout_coeff                              0                    0
xu2.vref                                          0                    0
xu2.vb_2                                          0                    0
xu2.net427                                        0                    0
xu2.e60_int1                                      0                    0
xu2.e62_int1                                      0                    0
xu2.vzout_vcc_coeff                               0                    0
xu2.ezout_vcc_coeff_int1                          0                    0
xu2.net310                                        0                    0
xu2.ezout_iout_coeff_int1                         0                    0
xu2.ezout_int1                                    0                    0
xu2.vout_diff__sr_vcc                             0                    0
xu2.vout_diff                                     0                    0
xu2.icc_out_high                                  0                    0
xu2.e_iccsat_high_int1                            0                    0
xu2.icc_out_low                                   0                    0
xu2.e_iccsat_low_int1                             0                    0
xu2.v_io_val                                      0                    0
xu2.e_readio_int1                                 0                    0
xu2.vb_2_vref                                     0                    0
xu2.vdep_sink                                     0                    0
xu2.vb_vref                                       0                    0
xu2.val_vdep_source_filtered                      0                    0
xu2.e_vdep_source_2_int1                          0                    0
xu2.val_vdep_source                               0                    0
xu2.e_vdep_source_1_int1                          0                    0
xu2.evlim_high_vout_int1                          0                    0
xu2.ro1_voh                                       0                    0
xu2.evlim_low_vout_int1                           0                    0
xu2.ro1_vol                                       0                    0
xu2.vol_norl                                      0                    0
xu2.vdep_source                                   0                    0
xu2.e_vdep_source_3_int1                          0                    0
xu2.val_vdep_sink_filtered                        0                    0
xu2.e_vdep_sink_2_int1                            0                    0
xu2.val_vdep_sink                                 0                    0
xu2.e_r1_int1                                     0                    0
xu2.net450                                        0                    0
xu2.net444                                        0                    0
xu2.e_vol_norl_int1                               0                    0
xu2.e_vdep_sink_3_int1                            0                    0
xu2.net410                                        0                    0
xu2.e_vdep_sink_1_int1                            0                    0
xu2.g_iccsat_outlow_int1                          0                    0
xu2.g_i_io_int1                                   0                    0
xu2.g_iout_sourced_int1                           0                    0
xu2.g_iib_vm_int1                                 0                    0
xu2.g_icc_int1                                    0                    0
xu2.g_iccsat_outhigh_int1                         0                    0
xu2.g_iib_vp_int1                                 0                    0
xu2.g_iout_sinked_int1                            0                    0
in                                                0                    0
b.xu2.bg_iout_sinked#branch                       0                    0
v.xu2.vreadio#branch                              0                    0
b.xu2.bg_iib_vp#branch                            0                1e-12
b.xu2.bg_iccsat_outhigh#branch                    0                    0
v.xu2.v_outvlim_high#branch                       0                    0
b.xu2.bg_icc#branch                               0             4.45e-05 *
b.xu2.bg_iib_vm#branch                            0                1e-12
b.xu2.bg_iout_sourced#branch                      0                    0
b.xu2.bg_i_io#branch                              0                    0
b.xu2.bg_iccsat_outlow#branch                     0                    0
v.xu2.v_outvlim_low#branch                        0                    0
b.xu2.be_vdep_sink_1#branch                       0               4.8623 *
b.xu2.be_vdep_sink_3#branch                       0                    0
b.xu2.be_vol_norl#branch                          0                    0
b.xu2.be_r1#branch                                0                    0
v.xu2.vreadi_r1#branch                            0                    0
b.xu2.be_vdep_sink_2#branch                       0                    0
b.xu2.be_vdep_source_3#branch                     0                    0
b.xu2.bevlim_low_vout#branch                      0                    0
b.xu2.bevlim_high_vout#branch                     0                    0
b.xu2.be_vdep_source_1#branch                     0             -33.1801 *
b.xu2.be_vdep_source_2#branch                     0                    0
b.xu2.be_readio#branch                            0                    0
b.xu2.be_iccsat_low#branch                        0                    0
b.xu2.be_iccsat_high#branch                       0                    0
b.xu2.bezout#branch                               0                    0
b.xu2.bezout_iout_coeff#branch                    0                    1 *
b.xu2.bezout_vcc_coeff#branch                     0                    1 *
b.xu2.be62#branch                                 0                    0
b.xu2.be60#branch                                 0                    0
l.xu2.lout#branch                                 0                    0
e.xu2.eilim_source#branch                         0                    0
e.xu2.e_vdep_sink_1#branch                        0                    0
e.xu2.e1_ref#branch                               0                    0
e.xu2.e_vdep_sink_3#branch                        0                    0
e.xu2.e_vol_norl#branch                           0                    0
e.xu2.e_vref#branch                               0                    0
e.xu2.e2_ref#branch                               0                    0
e.xu2.e_r1#branch                                 0                    0
e.xu2.e_vdep_sink_2#branch                        0                    0
e.xu2.e_vdep_source_3#branch                      0                    0
e.xu2.evlim_low_vout#branch                       0                    0
e.xu2.evlim_high_vout#branch                      0                    0
e.xu2.e_vdep_source_1#branch                      0                    0
e.xu2.e_vdep_source_2#branch                      0                    0
e.xu2.emeas_vout_diff#branch                      0                    0
e.xu2.emeas_vb_vref#branch                        0                    0
e.xu2.eilim_sink#branch                           0                    0
e.xu2.e58#branch                                  0                    0
e.xu2.e_readio#branch                             0                    0
e.xu2.e_iccsat_low#branch                         0                    0
e.xu2.e_iccsat_high#branch                        0                    0
e.xu2.e_sr_vcc_modulation#branch                    0                    0
e.xu2.ezout#branch                                0                    0
e.xu2.ezout_iout_coeff#branch                     0                    0
e.xu2.ezout_vcc_coeff#branch                      0                    0
e.xu2.e62#branch                                  0                    0
e.xu2.e60#branch                                  0                    0
v3#branch                                         0                    0
v1#branch                                         0                    0
v2#branch                                         0                    0
v.xu2.vprot_in_m_vccp#branch                      0                    0
v.xu2.vprot_in_p_vccn#branch                      0                    0
v.xu2.vprot_in_m_vccn#branch                      0                    0
v.xu2.v_enhance_vccp#branch                       0                    0
v.xu2.v_enhance_vccn#branch                       0                    0
v.xu2.vprot_in_p_vccp#branch                      0                    0
v.xu2.vos#branch                                  0                    0
v.xu2.v56#branch                                  0                    0
v.xu2.v57#branch                                  0                    0
doAnalyses: iteration limit reached
run simulation(s) aborted

Eeschema → File Open “OpAmp-Test-TSX631.kicad_sch” → Inspect → Simulator → Sim Command → Compatibility Mode “PSPICE and LTSPICE”

It is necessary to set the compatibility mode so that ngspice may understand PSPICE models.

I checked and this is already set:

(If it was not set, I would have considered it a bug in KiCad, as such settings should be stored in the project).

Edit: Added version info, as it may be bug related.

Application: KiCad x86_64 on x86_64

Version: 7.0.7-7.0.7~ubuntu20.04.1, release build

Libraries:
	wxWidgets 3.2.1
	FreeType 2.10.1
	HarfBuzz 6.0.0
	FontConfig 2.13.1
	libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3

Platform: Linux Mint 20.3, 64 bit, Little endian, wxGTK, xfce, x11

Build Info:
	Date: Aug 13 2023 23:14:53
	wxWidgets: 3.2.1 (wchar_t,wx containers) GTK+ 3.24
	Boost: 1.71.0
	OCC: 7.5.2
	Curl: 7.88.1
	ngspice: 38
	Compiler: GCC 9.4.0 with C++ ABI 1013

Build settings:
	KICAD_SPICE=ON

OpAmp-Test Works fine on Mac… using v7.0.7

MIF-ERROR - unable to find definition of model a$poly$e.xu2.e_ro1_voh

is a sign for an installation problem. The code models are missing. This is a package problem, out of my reach.

That was enough of a hint for me.

paul@cezanne:/etc/apt/sources.list.d$ apt search ngspice
p   libngspice-kicad                       - Library (shared) for ngspice. Used by kicad      
p   libngspice-kicad-dev                   - Spice circuit simulator - development files for l
p   libngspice-kicad-doc                   - Doc for library (shared) for ngspice. Used by kic
i A libngspice0                            - Spice circuit simulator - library                
p   libngspice0-dev                        - Spice circuit simulator - development files for l
p   ngspice                                - Spice circuit simulator                          
p   ngspice-dev                            - Spice circuit simulator - development files for n
p   ngspice-doc                            - Documentation for the NGspice circuit simulator  
p   ngspice-kicad-dev                      - Spice circuit simulator - development files for n
paul@cezanne:/etc/apt/sources.list.d$ sudo apt install libngspice-kicad
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  libngspice0
The following NEW packages will be installed:
  libngspice-kicad
0 upgraded, 1 newly installed, 1 to remove and 16 not upgraded.
...

After installing the libngspice-kicad package it worked for me too.
I created a packaging issue for this. I’m not sure if I put it in the right place, but it is the closest I could find:

Yes, it works. Thanks.
The works done are huge: Kicad side (eeschema, pcb, aso) and the integration of ngspice. Congratulations.
However, the learning curve of ngspice within Kicad is steep. Especially regarding the error messages.
In my case:

Error: Transient op failed, timestep too small

or
Error: Transient op failed, timestep too small
were misleading as the error was standing in the voltage source in the schematics.
As a suggestion for improvement, before running the simulation, would it be possible perform sanity checks ? More precise error messages will help, pointing in the right direction !
Despite these hurdles, the Kicad package is of great quality and the simulation tool extremely usefull.
Best !

There are huge improvements in the simulator integration in 8.0.

While the error reporting per se didn’t get that much better, there are at least far fewer things that generate errors…

Just getting back to V6 level would be a huge improvement compared to V7.

I’d like to think it’s considerably better even than V6.

But I didn’t use it much in V6…

Regarding,

What do you mean " was standing"

I too am trying to hunt down a Error: Transient op failed, timestep too small` but I do not yet understand your solution. (I will re read some more and perhaps will get it.)

But if you could restate your problem and restate the fix and why the error message appeared as it did that might help us.

Thanks,
Forrest Lee Erickson

As far as I remember, there was an error in my schematics with the power supplies. This was a bit hard to nail down as the error given by Spice was misleading. I had difficult times to set-up a working simulation. But once it does work, it is definitely useful.

That for getting back regarding this.

I think I am fighting two problems. One is that I got a library part for an E POLY source with had no template. I may have overcome that. I now am trying to figure out a failure

Error: Transient op failed, timestep too small
Transient solution failed -

Here is the thread I started on my issue: