"circuit not parsed." trying to simulate

Hi,
I want to simulate an opto-isolator driven by an open-drain gate.

Since I can’t do that, I decided to start by simulating this:

However, I am unable to simulate either OP or TRAN. I believe the issue is “Error: circuit not parsed.

My system is Ubuntu 25.04
Kicad 9.0.3
ngspice 43

the open-drain inverer model is taken from KiCad-Spice-Library/Models/Digital Logic/74HC.LIB at master · kicad-spice-library/KiCad-Spice-Library · GitHub

please help me

best regards
Max

based on the warning/error Dot command '.probe alli' and digital nodes are not compatible, I would try unchecking the “save all currents” option in the analysis setup.

For background, behind the scenes that checkbox adds the .probe alli ngspice directive (.probe alli == “probe all current vectors”). I guess your 74HC05 uses an event-driven digital model rather than a traditional analog spice model, and those digital models are incompatible with probing internal current nodes, I think.

Hi @gkeeth

I would try unchecking the “save all currents” option in the analysis setup.

tryied as suggested here:

.probe_alli error disappears, but the underlying problem remains:

any other suggestion?

regards
Max

Start with some working examples. ngSpice is a bit finicky to get started, and when you start with working examples, you can modify them in steps toward what you want to simulate. If it breaks, it was in the last thing you changed.

Maybe try to update to ngspice 44.

It works for me:

This is my project:

74HC05.zip (11.4 KB)

1 Like

Where’s the power supply for your inverter? They don’t work without one, also not in simulation.

Depends on the simulation model. This model works without.

1 Like

Interesting and new to me. But then I’m a beginner.

Hi @lucas

Maybe try to update to ngspice 44.
It works for me:

Unfortunately not for me. Updated:

max@jarvis:~/Downloads/ngspice$ ngspice --version
******
** ngspice-44.2 : Circuit level simulation program
** Compiled with KLU Direct Linear Solver
** The U. C. Berkeley CAD Group
** Copyright 1985-1994, Regents of the University of California.
** Copyright 2001-2024, The ngspice team.
** Please get your ngspice manual from https://ngspice.sourceforge.io/docs.html
** Please file your bug-reports at http://ngspice.sourceforge.net/bugrep.html
** Creation Date: Sun Jan 12 08:19:15 UTC 2025
******

same result in simulation

regards
Max

I’ve drawn Massimilioano_Cialdi’s circuit using the same library linked to.
I get exactly the same errors.
V8.0.9, ngspice 43.

Hmm. Could you try something else. Add a text box to your circuit with the following content:

.control
version
set auto_bridge = 1
.endc

Explanation:

  • version: Prints out the version of ngspice. Just to make sure that KiCad is actually picking up ngspice44 and not an older version for some reason. You should also be able to check this under the menu Help->About KiCad->Version
  • set auto_bridge = 1: I think this should explicitly enable auto bridging between digital and analog circuits.

Unfortunately the model chosen here is not useful in current KiCad/ngspice. Even if I can reproduce the findings of Lucas (simulation is running using KiCad 9.0.3 with ngspice-44.2), the result (output swing 0 to 3.3V instead of 0 to 1V) does show that the model does not act as an open-collector unit. That’s a bug in ngspice, probably in conjunction with the auto-bridging. We will have to look at it.

So what to do?

  1. Create your own model, using a digital buffer with delay and a simple bipolar transistor:
.subckt ocinv in out
a6 in intout buff1
.model buff1 d_buffer(rise_delay=18n fall_delay=13n)
Rb intout bb 10k
Q1 out bb gnd outbip
.model outbip npn
.ends
  1. Use analog TI model from SN74HC05 data sheet, product information and support | TI.com. This will require placing and wiring the inverter symbol and its power supply symbol. Proper pin assignment is required.

The printout of the updated ngspice by Massimilliano does show standard ngspice updated. However this is not used by KiCad. KiCad does use ngspice as a shared library. Its location depends on the operating system.

1 Like