I am making up my own component library and I want to add spice models to everything that I can while I do so. I am trying to add the provided spice model for the Nexperia BCM857BS (click on ‘Documentation’ and down at the bottom there is a file titled ‘BCM857BS SPICE model’) to my symbol, but it does not appear to be compatible with KiCad.
In the Symbol Editor, I click on ‘Add Simulation Model’ and point it to the downloaded .txt file on my computer, select the model provided, but it doesn’t assign any actual values to the component. The .txt is human readable and almost definitely provides the required values. I’ve already renamed the file extension to .lib and .sub in the vain hope that this would achieve anything, but to no success (KiCad gave out to me when I renamed it to *.ibs).
I would appreciate any help in this matter. I know KiCad uses ngspice, and I assume ngspice does not like how the txt file is formatted, but I scoured the internet for a solution to this with no helpful results to show for it.
Thanks in advance
BCM857BS.txt
***********************************************************
*
* BCM857BS
*
* Nexperia
*
* Matched double PNP/PNP transistor
* IC = 100 mA
* VCEO = 45 V
* hFE = 200 - 450 @ 5V/2mA
*
*
*
*
* Package pinning does not match Spice model pinning.
* Package: SOT 363
*
* Package Pin 1/4: Emitter TR1/TR2
* Package Pin 2/5: Base TR1/TR2
* Package Pin 3/6: Collector TR2/TR1
*
*
* Extraction date (week/year): 14/2020
* Spicemodel includes temperature dependency
*
**********************************************************
*#
* Please note: The following model is to be used twice in
* schematic due to equality of both Transistors.
*
* Diode D1, Transistor Q2 and Resistor RQ
* are dedicated to improve modeling of quasi
* saturation area and reverse mode operation
* and do not reflect physical devices.
*
.SUBCKT BCM857BS 1 2 3
Q1 1 2 3 MAIN 0.9404
Q2 11 2 3 MAIN 0.05956
RQ 1 11 287.6
D1 1 2 DIODE
*
.MODEL MAIN PNP
+ IS = 1.799E-014
+ NF = 1.022
+ ISE = 1.679E-015
+ NE = 1.407
+ BF = 305.1
+ IKF = 0.1058
+ VAF = 29.33
+ NR = 1.018
+ ISC = 3.907E-015
+ NC = 1.323
+ BR = 9.633
+ IKR = 0.04361
+ VAR = 15.48
+ RB = 225
+ IRB = 3.5E-005
+ RBM = 0.58
+ RE = 0.4884
+ RC = 0.3001
+ XTB = 1.52
+ EG = 1.11
+ XTI = 11.42
+ CJE = 1.169E-011
+ VJE = 0.636
+ MJE = 0.3558
+ TF = 8.145E-010
+ XTF = 2.568
+ VTF = 5
+ ITF = 0.08275
+ PTF = 0
+ CJC = 6.022E-012
+ VJC = 0.623
+ MJC = 0.4213
+ XCJC = 1
+ TR = 1.2E-007
+ CJS = 0
+ VJS = 0.75
+ MJS = 0.333
+ FC = 0.7148
.MODEL DIODE D
+ IS = 1.012E-016
+ N = 0.9929
+ BV = 1000
+ IBV = 0.001
+ RS = 3.939E+004
+ CJO = 0
+ VJ = 1
+ M = 0.5
+ FC = 0
+ TT = 0
+ EG = 1.11
+ XTI = 3
.ENDS
*
This may be a problem with viewing the file directly from this forum, on my phone, but there appears to be bullet point formatting in the file. So even if that doesn’t show up on a real editor, it may signal some hidden ascii.
It certainly seems that the BC857BS model from Diodes Inc actually works. The only problem is that the pins aren’t assigned properly - the model seemingly only wants 4 as opposed to the 6 that are physically on the package and correctly labelled on the symbol I made. The pin assignment tab on KiCad’s Simulation Model menu only provides (C) (E) (B) and (<S>). Unless I’m missing something very obvious, this won’t work with a dual BJT package.
Tried that already. Same issue unfortunately. Plus it includes different models, typ, fast and slow, which KiCad is very unhappy about and does not want to use. I believe this indicates some fundamental incompatibility with ngspice, but I cannot find out which spice library Diodes Inc. or Nexperia are targeting with their spice model files. If anyone could help in this regard, it might help me convert them to something ngspice will play nicely with.
Sorry sfnagle, only saw your comment now. For whatever reason, the forum has absolutely mangled the text from the spice model file. Those bullet points don’t exist in the actual file.
EDIT: Sorry I misunderstood what I was looking at. Those asterisks do exist in the text file. I presumed they were comments? I would be surprised if there were hidden ASCII characters as it was just a text file you can view by clicking on the file on the Nexperia website.
I think part of the problem is that the models expect to be applied once to one part of the transistor and once to the other. KiCad just does not seem to support this? For context, both transistors are one part of a single symbol in my setup, to represent them as being part of the same package.
No spice dialect supports this. Spice expects a netlist and associated models.
Your problem is not spice, but how to represent this graphically/logically.
Understandable. Is there no way to edit a SPICE file and say to it, hey, there’s two of you in this one package?
Separately, KiCad is NOT playing ball with SPICE files with ‘.subckt’ in them. I am trying to add several Toshiba BJTs to my library and that was what was preventing KiCad assigning the correct values in ‘Parameters’ tab.
If you have a multi-unit symbol (e.g. from a dual opamp, a dual bipolar transistor or a quad nand gate …) and your ngspice model from the vendor is addressing only a single device, for example the bipolar model has only 3 pins (C, B, E), but your symbol has 6, then you have to create an intermediate ngspice subcircuit.
I do not understand this “error message”. Of course KiCad/ngspice will read bipolar subcircuit models. So please give an example of something not behaving correctly.