How to debug simulation error?


I tried to implement a BFR106 NPN transitstor with the SPICE code given on the Infineon homepage.
I made a simple setup to test the implementation:

Unfortunately, I am receiving the following error when testing the setup:
Circuit: KiCad schematic
Background thread stopped with timeout = 0
Doing analysis at TEMP = 27.000000 and TNOM = 27.000000
Warning: v_sin: no DC value, transient time 0 value used
Initial Transient Solution
Node                                   Voltage
----                                   -------
net-_r_load-pad2_                      9.35189
net-_npn_q-pad1_                       10.2871
net-_r_q_bias-pad2_                         25
xnpn_q.22                             0.778011
xnpn_q.33                         -3.33067e-16
xnpn_q.11                              10.2871
xnpn_q.20                             0.778011
xnpn_q.30                         -1.11022e-16
net-_npn_q-pad2_                      0.778011
net-_r_q_base-pad2_                          1
l.xnpn_q.lcx#branch                 -0.0283736
l.xnpn_q.lex#branch                  0.0285955
l.xnpn_q.lbx#branch               -0.000221989
l.xnpn_q.le#branch                   0.0285955                -0.000221989
v_q#branch                          -0.0377254
v_sin#branch                      -0.000221989
Reference value :  0.00000e+00
doAnalyses: TRAN:  Timestep too small; time = 1e-17, timestep = 1.25e-18: trouble with xnpn_q:m_bfr106-instance q.xnpn_q.q1
run simulation(s) aborted

Somehow I can not imagine, that the SPICE model on the Infineon homepage is not correct. Therefore, I would like to debug my implementation but the error message is not very helpful. Has someone a hint how to approach the problem?


I did some checks. Indeed it is what the error message says: ngspice has a convergence problem with the model parameters for device q1 inside of the infineon subcircuit model.

We will look into this, but I do not yet have a quick solution.

Thank you for the feedback. When replacing the BFR106 by the model of the BFR92, I do not get any convergence issue.

Hence, it does not seem to be a general issue with the Infineon model.

However, I am looking for the BFR106. Any support would be great.

I’m new here, and not yet a KiCad user, but I do have some experience with Spice in general and Infineon models in particular.

Depending in the intended MOSFET application, Infineon has different levels of model complexity. The more complex ones can sometimes be very accurate, but the tradeoff has been simulation speed and convergence difficulty. Very often this will require adjustment of the simulation parameters using the .option feature of Spice, and this is a deep hole to get into. Sorry that I do not know of a good online reference for this, but it is a place to start. When doing this, you should have some idea of how the circuit is supposed to behave, since if the circuit has the potential for complex behavior, it can happen that one can get convergence to the wrong answer.

Hope this helps,

Basically you are right. Just google ‘spice non-convergence’ and you will find some very useful links.

Here we have a special case: The circuit is very simple, just the bipolar transistor and some bias resistors. The infineon model is a subcircuit model for a high frequency bipolar transistor, containing some (package?) parasitics, and then internally calling the standard spice bipolar model with a dedicated .model line.

If I isolate this transistor, I can run a nice dc simulation. If on transient simulation, I get the operating point of the attached circuit, which looks reasonable, but then ngspice refuses to do the first transient simulation step, even after I have removed the parasitics elements from the subcircuit.

I am aware that for complicated circuits, simulation might not converge (especially if the are far of the operation point). Therefore, I tried to implement more or less the simplest circuit.

Can someone verify with another tool/solver that the model is correct? Maybe Infineon messed up something?

It works fine in LTspice.

I did some playing around and it seems like an ngspice bug. I narrowed down the problem to the BJT model parameter MJS. If I remove it, it works. If I change it from 1 to 0.99, it works. If I change it from 1 to 1.01, it works. And here is where it gets weird…if I change it from 1 to 1.00…it also works. So something with how ngspice is parsing this parameter???

Anyway, @paru to get your simulation running, edit the line in the .LIB file to say:

 +	MJS	=	1.00

Thank you for the patch.

This seems to be a really special paramenter. Ste, thanks for your analysis. I will have a look at the source code.

I first thought it was something to do with integer vs floating point…but what I didn’t mention above was that changing 1 to 1.0 (only one digit after decimal) also did not work. That’s when I gave up trying to guess what was going on. I don’t know if that’s useful, but I thought I’d share it.

The default value for MJS is 0. ADS simulator in their bipolar model says that it is even fixed at 0. For other device models (MOS transistors) ngspice limits this value to 0.99. This what LTSPICE has probably already done. The choice of MJS=1 at least is questionable in the Infineon model, because CJS is 0 anyway. They’d better chosen the default.

ngspice will limit MJS to 0.99 as well, if our modeling expert agrees.

I agree with this as well. M (which is the grading coefficient) is ideally supposed to only range between 0.33 and 0.5, where 0.33 is linearly graded PN junction and 0.5 is abrupt. Modelers tweak past these values to induce curves which match real life data in certain instances. But 1.0 seems really extreme, and the junction capacitance equation might become unstable. I suspect the Infineon model incorrectly set this parameter, like you suggest.