AC simulation woes (KiCAD 9)

@holger this is probably one for you and I know it’s been asked before, but I’ve tried the usual suspects and I’m baffled.

I’ve got an AC stimulus going into (for this example) an RC low-pass, really nothing complex. The transient analysis works a treat - although it’s slow to chart compared to LTSpice running on the same machine.

1Hz to 10Meg, nothing… 1K to 100Meg nothing… It’s really weird because I’m sure I ran some more complex simulations in KiCAD 7 without an issue. I’ve got an issue I need to track down and simulation is the only way I’m going to find it in this lifetime. One or more of the op amps on my board is running into a capacitive load. (Maybe parasitic, maybe I’m an idiot - you can take a guess…) . and producing a lovely 4 MHz sine that’s so nice, you’d think I’d designed it using a precision LC tank or even a DDS with a decent 16 bit DAC.

But on AC — I’m drawing a blank - literally, no chart nothing, even even tried entering the range backwards to see if that changes anything. Same effect - when I click run simulation the stop button flashes as if some code has run but that’s all. Now the ONLY thing I can think of that might be “throwing a lump of molten solder in on a live PCB” is that on Debian KiCAD is in one of those Flathub packages which have upset other software in the past. Debian only packages up to KiCAD 6 and that’s like going back to wire wrapping and manual tape. Man this software develops at a pace and I’ll be delighted to send some more filthy lucre your way before year’s end 2025.

On a related note, can someone explain in words that this idiot can understand with my appalling knowledge of vector calculus, how I set up a Pole/Zero simulation and what it does? I know what they are, but I’m unclear what sort of simulation I would use them for. I’m very conscious of capacitive loading and I’m usually far more careful but I’ve slipped up this time and Pole Zero analysis sounds like it may help (even if I have to break the loop with some 1T inductors and 1T caps like Texas Inc. suggest.

Not a reply about the simulation, but to decouple a capacitive load, on an opamp (like driving a guitar cable) try a small series resistor (try 10 to 100-ish ohms) in the output. Best to use a buffer (not gain) config for this.
1

And if you are getting an oscillation, try adding a small cap across the feedback resistor – you get a first-order low-pass rolloff with -3dB at 1/(2piR*C) which you probably want anyway to band-limit your circuit.
2

Please have a look at KiCad Eeschema as GUI for ngspice, tutorial for setting up the simulation for a simple ac simulation.

Thanks @teletypeguy, I’ve already done that where I knew I was driving capacitive loads - I found this out the hard way trying to make a multi-5532 headphone amp. I don’t have a lot of room on the prototype to scrape off the tracks and drop some isolation impedance in. It’s a we bit more complicated because these are discrete differential amps - simply to save money vs. (say) a THAT151x or similar mic amp.

I was saying to the JLC rep the hilarious irony of this is that the digital side works a treat and the 27762 charge pump is as quiet as a mouse that’s overdone it on the Christmas plonk. 250 mA (max) is quite something from a couple of small capacitors and no inductors in sight! But the very block I’ve been making since the 1980s (to “decode” Dolby stereo) failed spectacularly!

A dedicated buffer stage is an option, naturally, even a discrete one would be better. C’est la vie. Familiarity breeds contempt, n’est pa?

I’d already done that (and more) unfortunately, but it does appear to be an issue inside the FlatHub version of KiCAD.

As a test I ran KiCAD for Windows under Codeweaver’s CrossOver (I assume it works in Wine but I wanted to give it the “best” environment).

And would you look at that. Same circuit, same simple simulation (I even added an op amp into the mix).

When I rebooted the machine from a cold start, the first simulation (literally an RC) ran first go but as soon as I added the op amp (the simple one from the internal set) “poof” not a dicky bird. Same thing in the Windows (under Wine) and it’s working a treat. Even showing things like that little peak in the curve at HF. I need to model the parastics to get this nailed down so that should see me right now.

Texas has a series on what @teletypeguy was referring to by breaking the loop with high value inductors and capacitors but LT has what appears to be a more elegant solution using a DC bias on the input which I’m eager to try, although I’ll have to get the 5532 model working otherwise I’ll be throwing darts in the dark! 5532s aren’t my first choice these days but they’re a jellybean and cheap… :slight_smile:

I’m still in the dark over pole/zero simulation. but I’ll have a gander at the manual and see if that sheds any light on it. I’m coming from LTSpice primarily. I find TINA and Microcap far too clumsy for schematic capture whereas KiCAD and LT are quick and painless. I’m very poor at math so I tend to rely on graphical analysis to help me check my working.

I have to wonder if some of the negative reviews KiCAD is getting on Debian are partly or wholly due to issues with FlatHub acting up? That would be an awful shame as the FlatHub isn’t maintained by your team as I understand and “bugs” caused by the external system aren’t your fault.

I’d file a bug report for this but I don’t even know who to tell!

image

A quick bit of visual insight – to design an analog filter or processing block, the desired response is defined by a transfer function equation (that defines the relation of the output to the input) in the time domain. A Laplace transform converts it to a representation in the s-plane – this is the complex frequency domain where the horizontal axis denotes the real part (σ) and the vertical axis denotes the imaginary part (jω) of the complex variable ‘s’. In the s-domain, the transfer function is an equation that has a numerator and denominator: H(s) = B(s) / A(s). So, when the numerator B(s) goes to zero (at some specific frequency), the output goes to zero (exemplified by the stopband dips in an elliptical filter), and when the denominator goes to zero (at some specific frequency), well, recall that something divided by zero = infinity (yes, divide by zero is an error on a computer, but it is infinity) – this is a pole.

When the s-domain is plotted in 3d, you can see the poles (and zeros if they are used). When you slice down through σ = 0, you see the magnitude response (positive jω) shown as red lines below – which is pretty cool! You can see how the peaks occur as the response gets pulled up by a pole, or sucked down by a zero.


I find that these 3d graphs (grabbed from an adi app note) provide a lot of insight into how the pole/zero positions affect the response. Also note that a second-order filter has two poles, a fourth-order has four poles…

1 Like

That is a wrong assumption. On bookworm (Debian 12) backports there is KiCad 9.0.2 available (see also Debian -- Details of package kicad in bookworm-backports). An instruction how to install a backports package is available at Instructions.

1 Like

That’s probably due to wrong settings. Make TSTEP 10 times larger, and the simulation will be 10 times faster. As you did not give any details, this is just a guess.

1 Like

Not a KiCAD issue, this seems to be related to the FlatHub package.

I’ll try this and report back when I get a moment. I’m starting to think I’d be better served running the Windows build under Crossover as that seems to run into few rakes! I can’t blame KiCAD for an issue caused by a packaging system.

Apologies for the multiple replies, I’m unused to modern boards like this one.

Blockquote
That is a wrong assumption. On bookworm (Debian 12) backports there is KiCad 9.0.2 available (see also Debian – Details of package kicad in bookworm-backports). An instruction how to install a backports package is available at Instructions.

AH! That’s where it’s hiding! Thanks @holger - that’s had me climbing the walls.

Blockquote
A quick bit of visual insight – to design an analog filter or processing block, the desired response is defined by a transfer function equation (that defines the relation of the output to the input) in the time domain. A Laplace transform converts it to a representation in the s-plane – this is the complex frequency domain where the horizontal axis denotes the real part (σ) and the vertical axis denotes the imaginary part (jω) of the complex variable ‘s’. In the s-domain, the transfer function is an equation that has a numerator and denominator: H(s) = B(s) / A(s). So, when the numerator B(s) goes to zero (at some specific frequency), the output goes to zero (exemplified by the stopband dips in an elliptical filter), and when the denominator goes to zero (at some specific frequency), well, recall that something divided by zero = infinity (yes, divide by zero is an error on a computer, but it is infinity) – this is a pole

That’s really cool. I don’t have much of a mathematical bent (long story) but I had complex needs as a kid and ended up in the sort of school where skool was an accepted spelling if you catch my drift.

My introduction to calculus (such as it was) failed to point out - that or I failed to notice that the answer to a problem was often another function. Visual charts are so much easier to help me wrap my ageing brain around. I’m a writer by trade with a speciality in early computer systems and maths wasn’t something I needed. Per the Art of Electronics, I try to avoid as much of the maths where possible/practical but there are times - such as this one - where computers come into their own. I recognise poles and zeros on a 2D chart easily enough from the rolloff and phase characteristics but that’s only part of the problem as your graphic clearly shows! The ripple in the passband of a Chebychev is quite dramatically illustrated there.

Yeah, I went down a headphone amp path a few years ago, curious about the simple cmoy and spinoff designs. The 5532 is one of dozens of good opamp candidates. I designed and built this and it works quite well: