I can do analog simulations and I can do digital simulation (using 74HCxxxM.zip models), but they do not mix apparently. Is there an ‘analog’ 74x library that supports analog simulation available?
That’s wrong. Please see my example Mixed Signal (Analog + Digital) Simulation at Simulation examples for KiCad/Eeschema/ngspice - #4 by holger , where besides digital signals, also analog signals are used (RC delays) to create a clock signal of certain width. The interface between analog and digital is automatically created. A KiCad 8 version may be found at https://forum.kicad.info/uploads/short-url/718yiYdfWYg0Xb3Dqox2ldgAqMQ.7z .
I am not aware of any library of digital devices made by analog circuitry (e.g. behavioral or CMOS gates). There may be some special devices where TI offers such a model (not the IBIS models though, which are only describing the interface, not the logic!). Besides digital models at https://ngspice.sourceforge.io/model-parameters/74HCxxxM.zip (adapted for footprint and symbol) and https://ngspice.sourceforge.io/model-parameters/74xx-models.7z (not yet adapted), there is another set of digital models available at KiCad-Spice-Library/Models/Digital Logic at master · kicad-spice-library/KiCad-Spice-Library · GitHub, but this again does not take any footprint or symbol node numbering into account.
I do believe I’m right, because I have not found a way to use an analog simulation model like BJT, NJF, OPAMP, or whatever, in conjunction with digital models from 74HCxxxM.zip. If this is possible, please let me know how to do that! For now, I used LTSpice which solved the problem for the day, but I would prefer to do both design and simulation in the same tool.
Please provide a simple project here (zipped, with all model used) where you tried but were not successful.
Attached you will find a simple mixed signal sim project, analog astable oscillator plut digital divide by four.
mix_osc_7474.7z (12.1 KB)
Unfortunately somewhat brittle, may crash, much better with upcomimg ngspice-43.
Many thanks for this, you solved my problem!
There seem to be a bug in version 8.05 (MacOS) that prevented me from succeeding: If at any point the check box “Save all currents” is checked, it must be unchecked and Kicad must be restarted before simulation succeeds. I also had quite a few crashes while figuring this out.
There also seem to be another bug; not all signals in the list have data, i.e. in the file you provided, there is a signal, V(Net-U1A-D), that is empty.
The only thing really missing is currents and power, though it may be worked around with sense resistors and some math.
Indeed the tick boxes ‘Save all Currents’ and ‘Save all Power Dissipations’ may not be used, as they try to measure current and power also in the digital part, which is not modelled.
However you may use the .probe
command for measuring current and power in analog devices individually. For example, in my circuit from above you may add
.probe I(R6)
.probe P(XQ1)
to a text box to measure current through R6 or power dissipation of Q1.
Why XQ1 and not Q1? Well, the transistor uses a subcircuit model, and its device instance thus starts with a prepended X.
You may give it a thumbs-up.