IR2101 Gate Driver with IRF3205 MOSFET Simulation KiCAD Crash Problem

Hello Everyone,

Its been Six months I’ve been using this wonderful tool … KiCAD.
Thanks to the team here at this forum, For starting, I got a lot of help from here. I’ve tried making simple circuits and simulating them in KiCAD.

I am currently stuck in simulating a circuit where IR2101 is driving MOSFETs (IRF3205).
I got device models from the manufacturer product page(IR2101.lib, irf3205.spi, and 1N4148.lib).

The issue I am facing here as soon as IR2101 is included in the simulation (Compatibility mode: PSpice), KiCAD crashes otherwise out of many combination (I’ve tried during two days effort to run the circuit), simulation either goes on or atleast talks to me (such as “step size too small”). However, as soon as i include IR2101 in the simulation, KiCAD crashes away (perhaps gets angry at me for some obvious mistake).

I am using KiCAD Ver. 7.0.5 on Windows 10, and including the *.lib/.spi models as “SPICE models from file”

I tried to attach the KiCAD project, but I think new users can’t upload attachments.
I shall be thankful for the rescue.

Regarding being a new user, check out New Member Information for instructions on upgrading yourself to be able to upload project files.

Regarding crash, I’m just guessing that there is something wrong with the specific model you have so ngspice is crashing and bringing down KiCad with it. If that guess is correct, the relevant bug report is tracked here (though unfortunately no timeline for fixing the issue is given yet): Spice simulator cause Kicad to crash if netlist includes a spice library with syntax errors (#14568) · Issues · KiCad / KiCad Source Code / kicad · GitLab

Or an ‘assist’ from a mod. User now equal basic. :wink:

1 Like

Thanks for a detailed response, based on that information I am uploading the schematic image (may be it can provide some insight for the mistake I am making).

I tried IR2104, its library provided by the Infineon … same situation.

If the crash is occurring as soon as you load the model into KiCad (selecting it in a symbol’s SPICE model editor) then the issue is unlikely to be the schematic, but the model file itself. Can you upload the entire project directory, including models? Alternatively, posting a link to the exact model you are working with could also be helpful.

1 Like

This is link to the model I am using:

https://www.infineon.com/dgdl/Infineon-IR2101-PSpice-SimulationModels-v01_00-EN.zip?fileId=5546d4627956d53f017960624961702c

Can I share the whole project folder using google drive?

You can do Google Drive if that’s fastest for you, but generally speaking it is nicer to upload .zip files of the project directly so that it is easy to reference later (link rot and all that). If you want to open a gitlab issue (or add to the existing one) in the future, you’d definitely need to upload a zipped project.

1 Like

Many thanks, in parallel I am exploring gitlab.
Perhaps, since I am not much expert at KiCAD … i think most probably some mistake by me is causing the trouble.

Project Files (RAR)

For whatever it is worth, .rar is not a cross platform compression system so many people will not be able to open the file as provided. Most OS’s other than Windows default to .zip rather than .rar for compression. There are certainly workarounds (on Mac there is a common utility called The Unarchiver) but I figured I’d let you know.

Anyways, I was able to open your schematic file without any issues and re-attach the IR1201 models without any issue. I noticed you’ve excluded the IR1201’s from simulation, presumably to keep it from crashing? I unchecked that setting on the top IR1201, no crash yet. I opened the simulator window, transient model with default settings, and set compatability to PSPICE. Running the simulation does result in an error message.

Note: Compatibility modes selected: ps a
Circuit: KiCad schematic
PWL-ERROR: prepare_PTF_PWL, not a constant
type = 3
Error: PWL(expr, points...) only *literal* points are supported
PWL-ERROR: prepare_PTF_PWL, not a constant
type = 3
Error: PWL(expr, points...) only *literal* points are supported
PWL-ERROR: prepare_PTF_PWL, not a constant
type = 3
Error: PWL(expr, points...) only *literal* points are supported
PWL-ERROR: prepare_PTF_PWL, not a constant
type = 3
Error: PWL(expr, points...) only *literal* points are supported
PWL-ERROR: prepare_PTF_PWL, not a constant
type = 3
Error: PWL(expr, points...) only *literal* points are supported
PWL-ERROR: prepare_PTF_PWL, not a constant
type = 3
Error: PWL(expr, points...) only *literal* points are supported
PWL-ERROR: prepare_PTF_PWL, not a constant
type = 4
Error: PWL(expr, points...) only *literal* points are supported
PWL-ERROR: prepare_PTF_PWL, not a constant
type = 4
Error: PWL(expr, points...) only *literal* points are supported
Error on line 0 or its substitute:
b.xu1.x_gd_template.x_hin_vcc_d.btable_new_8 xu1.x_gd_template.x_hin_vcc_d.table_new_8 0 v=pwl(v(probe_int_hin_xu1_5,probe_int_+v_xu1_6) , 0,0 ,    3.000000000000000e-01    *1.01,0 ,    3.000000000000000e-01    *1.02,    1.000000000000000e-03     , 10*    3.000000000000000e-01    , 100*    1.000000000000000e-03     )
parameter value out of range or the wrong type
Error: circuit not parsed.

Just for fun, I switched compatibility mode to PSICE and LTSPICE, hit OK, and immediately got a crash. This is reproducible with just the LTSPICE compatibility mode as well.

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Process:               kicad [10608]
Path:                  /Applications/KiCad/KiCad.app/Contents/MacOS/kicad
Identifier:            org.kicad.kicad
Version:               7.0.5-0 (7.0.5-0)
Code Type:             ARM-64 (Native)
Parent Process:        launchd [1]
User ID:               501

Date/Time:             2023-07-02 11:37:06.6325 -0700
OS Version:            macOS 13.4.1 (22F82)
Report Version:        12
Anonymous UUID:        0B770BD3-37DB-5FD8-F5F2-D277A651BA40

Sleep/Wake UUID:       CA36FC49-74D3-4307-A031-B5BD5D33B81C

Time Awake Since Boot: 84000 seconds
Time Since Wake:       942 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000010
Exception Codes:       0x0000000000000001, 0x0000000000000010

Termination Reason:    Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process:   exc handler [10608]

VM Region Info: 0x10 is not in any region.  Bytes before following region: 105556203274224
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      MALLOC_NANO (reserved)   6000b8000000-6000c0000000 [128.0M] rw-/rwx SM=NUL  ...(unallocated)

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libngspice.0.dylib            	       0x28504e9b4 modprobenames + 24
1   libngspice.0.dylib            	       0x285031480 inp_dodeck + 884
2   libngspice.0.dylib            	       0x28502f368 inp_spsource + 4560
3   libngspice.0.dylib            	       0x28502e190 inp_source_recent + 56
4   libngspice.0.dylib            	       0x285064fc0 com_rset + 96
5   libngspice.0.dylib            	       0x285016d5c docommand + 1060
6   libngspice.0.dylib            	       0x285016528 doblock + 2328
7   libngspice.0.dylib            	       0x285015960 cp_evloop + 3764
8   libngspice.0.dylib            	       0x285004368 runc + 464
9   libngspice.0.dylib            	       0x28500416c ngSpice_Command + 180
10  _eeschema.kiface              	       0x11aa1f978 NGSPICE::Init(SPICE_SIMULATOR_SETTINGS const*) + 132
11  _eeschema.kiface              	       0x11aa2c1d8 SIM_PLOT_FRAME::onSettings(wxCommandEvent&) + 1716
12  libwx_osx_cocoau-3.2.0.2.1.dylib	       0x1054b2278 wxEvtHandler::SearchDynamicEventTable(wxEvent&) + 360
13  libwx_osx_cocoau-3.2.0.2.1.dylib	       0x1054b1f1c wxEvtHandler::ProcessEventLocally(wxEvent&) + 88
14  libwx_osx_cocoau-3.2.0.2.1.dylib	       0x1054b1d44 wxEvtHandler::ProcessEvent(wxEvent&) + 56
15  _eeschema.kiface              	       0x11ac17eb0 EDA_BASE_FRAME::ProcessEvent(wxEvent&) + 96
16  libwx_osx_cocoau-3.2.0.2.1.dylib	       0x1056c1fe4 wxWindowBase::TryAfter(wxEvent&) + 252
17  libwx_osx_cocoau-3.2.0.2.1.dylib	       0x1054b2538 wxEvtHandler::SafelyProcessEvent(wxEvent&) + 24
18  libwx_osx_cocoau-3.2.0.2.1.dylib	       0x1056ab5cc wxToolBarBase::OnLeftClick(int, bool) + 124
19  AppKit                        	       0x1a7b218a8 -[NSApplication(NSResponder) sendAction:to:from:] + 440
20  AppKit                        	       0x1a7b216c0 -[NSControl sendAction:to:] + 72
21  AppKit                        	       0x1a7b21604 __26-[NSCell _sendActionFrom:]_block_invoke + 100
22  AppKit                        	       0x1a7b2152c -[NSCell _sendActionFrom:] + 204
23  AppKit                        	       0x1a7b21450 -[NSButtonCell _sendActionFrom:] + 88
24  AppKit                        	       0x1a7b1ea54 NSControlTrackMouse + 1480
25  AppKit                        	       0x1a7b1e460 -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 144
26  AppKit                        	       0x1a7b1e318 -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 488
27  AppKit                        	       0x1a7b1d7e4 -[NSControl mouseDown:] + 448
28  AppKit                        	       0x1a7b1c2cc -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 3476
29  AppKit                        	       0x1a7aa6f08 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 364
30  AppKit                        	       0x1a7aa6bc8 -[NSWindow(NSEventRouting) sendEvent:] + 284
31  libwx_osx_cocoau-3.2.0.2.1.dylib	       0x105599678 -[wxNSWindow sendEvent:] + 124
32  AppKit                        	       0x1a7aa5f0c -[NSApplication(NSEvent) sendEvent:] + 1556
33  libwx_osx_cocoau-3.2.0.2.1.dylib	       0x1054c1138 -[wxNSApplication sendEvent:] + 100
34  AppKit                        	       0x1a7cf5fc4 -[NSApplication _handleEvent:] + 60
35  AppKit                        	       0x1a796d368 -[NSApplication run] + 500
36  libwx_osx_cocoau-3.2.0.2.1.dylib	       0x10558ff54 wxGUIEventLoop::OSXDoRun() + 196
37  libwx_osx_cocoau-3.2.0.2.1.dylib	       0x1054868c4 wxCFEventLoop::DoRun() + 40
38  libwx_osx_cocoau-3.2.0.2.1.dylib	       0x1053dd630 wxEventLoopBase::Run() + 192
39  libwx_osx_cocoau-3.2.0.2.1.dylib	       0x1053ae0a0 wxAppConsoleBase::MainLoop() + 208
40  libwx_osx_cocoau-3.2.0.2.1.dylib	       0x10552d888 wxApp::OnRun() + 36
41  kicad                         	       0x1029fc2c4 APP_KICAD::OnRun() + 28
42  libwx_osx_cocoau-3.2.0.2.1.dylib	       0x105410154 wxEntry(int&, wchar_t**) + 88
43  kicad                         	       0x1029fa7b8 main + 52
44  dyld                          	       0x1a4323f28 start + 2236

This is reproducible with a minimum case of just the Simulation_SPICE:OPAMP symbol in an otherwise empty schematic.
temp.kicad_pro (10.8 KB)
temp.kicad_sch (4.0 KB)
IR2101.lib (21.6 KB)
temp.wbk (90 Bytes)

All of this to say there are two or three issues here (from my point of view):
The IR1201 model is not fully compatible with ngspice (the underlying spice library) even with the PSPICE compatibility mode. Something about it is Really broken when you throw LTSPICE compatibility mode into the mix, even though they should be able to operate together (“LTPSA should be the standard” from PSPICE simulation fails permanently (#13589) · Issues · KiCad / KiCad Source Code / kicad · GitLab ).
Then there’s the KiCad level issue of crashing when ngspice does, which may be covered by the pair of these issues: Spice simulator cause Kicad to crash if netlist includes a spice library with syntax errors (#14568) · Issues · KiCad / KiCad Source Code / kicad · GitLab and Crashing simulation (ngspice) should not crash kicad / eeschema (#9756) · Issues · KiCad / KiCad Source Code / kicad · GitLab.

1 Like

Thanks for the suggestion regarding file type, yes that is so. I shall try to follow it in future.
Other than that, your response is a priceless rescue … spent many hours on it, in the clouds of uncertainity … taking it as my own mistake in making schematics.

Meanwhile, I am getting into gitlab.

I’m glad I was able to help! I’m unfortunately not good enough at SPICE to know why the IR1201 model is causing an error in PSPICE mode and causing a crash in LTSPICE mode, but I’d encourage you to create a new issue on the KiCad Gitlab and potentially generate a reproducible case for ngspice alone (though the lead dev on ngspice often pays attention to the KiCad gitlab as well).

1 Like

But your help enabled me to direction my effort,
I came across a discussion at sourceforge, there is some deep rooted (I am in learning mode) issue with infineos SPICE models at NGSPICE.

sourceforge discussion
Sourceforge link to the patched model of IR2101 (compatible with ngspice)

Schematic is not yet working, require further workout … but with this patched model atleast KiCAD does not head to a crash.

There is here : Simulation examples for KiCad/Eeschema/ngspice - #4 by holger
A file using a similar driver. Try using that one.

1 Like

Even with an incompatible model ngspice should not crash.

I will prepare a fix to ngspice.

3 Likes