Help with FFT analysis

Hello, I’m trying to make the switch from LTSpice to KiCad. I’m having some trouble getting FFT analysis working.

I’ve drawn a minimal schematic consisting of a VSIN source with a simple two resistor voltage divider across it. I can run a TRAN analysis and plot the voltage at the middle of the voltage divider. I’ve added a global label to this point named “here”.

TRAN parameters are time step 1us, stop time 100ms. VSIN is the default 1kHz.

When I add an FFT analysis I get this error:

Error: Missing token in line 7:
linearize v(here)
Please correct the input file
Error: ngspice.dll cannot recover and awaits to be reset or detached

If I deselect the linearize inputs check box I get:

Error: Not enough tokens in line 7
fft v(here)
Please correct your input file
Error: ngspice.dll cannot recover and awaits to be reset or detached

I’ve tried plotting unlabelled points by their full name with the same result.
I’ve tried the release build and the nightly build with the same result.
I’m on a Fedora 41 system.

Any advice would be appreciated.

The netlist of the successful TRAN analysis:

.title KiCad schematic
.save all
.probe alli
.probe p(R1)
.probe p(R2)
.probe p(V1)
.tran 1u 100m
R1 Net-R1-Pad1 here 100
R2 here GND 100
V1 Net-R1-Pad1 GND DC 0 SIN( 0 1 1k 0 0 0 ) AC 1
.end

And the netlist of the unsuccessful FFT analysis:

.title KiCad schematic
.save all
.probe alli
.probe p(R1)
.probe p(R2)
.probe p(V1)
linearize V(here)
fft V(here)
R1 Net-R1-Pad1 here 100
R2 here GND 100
V1 Net-R1-Pad1 GND DC 0 SIN( 0 1 1k 0 0 0 ) AC 1
.end

This netlist is buggy. Commands

linearize V(here)
fft V(here)

are not allowed in a netlist, but only in a .control section.

So more information is required. How did you try to invoke the fft sumulation?

Thank you, I must be doing this part wrong.
I have no spice text commands entered on the schematic. It contains only:

  • voltage source
  • resistors
  • ground
  • label

My steps from a clean restart:

  1. open schematic file
  2. click top toolbar button “Simulator”
  3. in the simulator window click top toolbar button “New Analysis tab…”
  4. select analysis type “TRAN” from drop down menu
  5. enter TRAN params Time step 1u, Final time 100m
  6. Compatibility mode says “PSpice and LTSpice”
  7. click “OK”
  8. TRAN analysis tab is now visible but empty
  9. click top toolbar button “Run Simulation”
  10. the right side panel contains a list of things I can plot. I click “V(here)”
  11. TRAN plot now visible
  12. in the simulator window click top toolbar button “New Analysis tab…”
  13. select analysis type “FFT” from drop down menu
  14. a list of input signals is offered. I click “V(here)”
  15. Checkbox “Linearize inputs before performing FFT” is checked
  16. Compatibility mode says “PSpice and LTSpice”
  17. click “OK”
  18. FFT analysis tab is now visible but empty and error is added to the output log:

Error: Missing token in line 7:
linearize v(here)
Please correct the input file
Error: ngspice.dll cannot recover and awaits to be reset or detached

  1. if I ignore error and click top toolbar button “Run Simulation” these additional errors are added to the output log:

** ngspice-44.2 shared library
** Creation Date: Sun Jan 12 00:00:00 UTC 2025


Note: No compatibility mode selected!
Circuit: *
Error: no such plot named tran1
Error: plot must be a transient analysis
Error: fft needs real time scale

O.k., I will have a look.
What is your KiCad and ngspice versions?

Application: KiCad Schematic Editor x86_64 on x86_64
Version: 9.0.0-rc3-1.20250212git32fd79c.fc41, release build
Libraries:
wxWidgets 3.2.6
FreeType 2.13.3
HarfBuzz 9.0.0
FontConfig 2.15.0
libcurl/8.9.1 OpenSSL/3.2.2 zlib/1.3.1.zlib-ng libidn2/2.3.7 nghttp2/1.62.1
Platform: Fedora Linux 41 (Workstation Edition), 64 bit, Little endian, wxGTK, X11, gnome, wayland
OpenGL: Intel, Mesa Intel(R) Graphics (ADL-N), 4.6 (Compatibility Profile) Mesa 24.3.4
Build Info:
Date: Feb 12 2025 18:09:43
wxWidgets: 3.2.6 (wchar_t,wx containers) GTK+ 3.24
Boost: 1.83.0
OCC: 7.8.0
Curl: 8.9.1
ngspice: 44.2
Compiler: GCC 14.2.1 with C++ ABI 1019
KICAD_IPC_API=ON
Locale:
Lang: en_US
Enc: UTF-8
Num: 1,234.5
Encoded кΩ丈: D0BACEA9E4B888 (sys), D0BACEA9E4B888 (utf8)

I installed the nightly build to see if that helped, but I had the same issue with the stable build.

It is the same with KiCad 8.0.8.
There seems to be a bug in Eeschema.

What you can do (same as yours):

  1. open schematic file
  2. click top toolbar button “Simulator”
  3. in the simulator window click top toolbar button “New Analysis tab…”
  4. select analysis type “TRAN” from drop down menu
  5. enter TRAN params Time step 1u, Final time 100m
  6. Compatibility mode says “PSpice and LTSpice”
  7. click “OK”
  8. TRAN analysis tab is now visible but empty
  9. click top toolbar button “Run Simulation”
  10. the right side panel contains a list of things I can plot. I click “V(here)”
  11. TRAN plot now visible
  12. in the simulator window click top toolbar button “New Analysis tab…”
  13. select analysis type “FFT” from drop down menu
  14. a list of input signals is offered. I click “V(here)”
  15. Checkbox “Linearize inputs before performing FFT” is checked
  16. Compatibility mode says “PSpice and LTSpice”
  17. click “OK”

File → Save Workbook

Close Simulator window.

Inspect → Simulator → Analysis 1 TRAN → Run → Analysis 2 FTT → Run

I will create a bug report.

1 Like

Thank you for your help, your steps work perfectly to get the FFT.

1 Like