Better yet: store KiCad simulation example source files in a Git repository, so they can easily be maintained, downloaded, synched and tagged and checked for changes. And documentation can follow along in associated markdown files.
Like any other source code
A new circuit at the top: A recently published high efficiency, high power RF generator for 13.56 MHz.
Thanks for making the examples. It is delightful to be able to model circuits this way.
While testing your âStep down converter with LM2576â with the nightly build from docker, I found a problem. The LM2576.7z file contains a pspice model in LM2576_TRANS.LIB.
On line 27 there are some non-UTF8 characters that will cause KiCad to fail to read the spice files. It wonât say much about the problem. The first sign that something is wrong is that no models will appear in the UI after you select the .LIB file. If you try to simulate the netlist will be empty.
I suspect the issue is with the definition of the spice parser in kicad. I suspect SafeReadFile() in common/richio.cpp is returning a blank string without giving the user feedback about the bad characters or their location.
Until this can be fixed it might be good to tell simulation users to check their spice files for non-UTF8 characters if they have problems simulating.
You can see there are two bytes with the value 0x96 on line 27.
$ (echo; cat -n LM2576_TRANS.LIB | grep -a Datash ; echo; cat -n LM2576_TRANS.LIB | grep -a Datash | hexdump -C )
27 * Datasheet: SNVS107D JUNE 1999REVISED MAY 2016
00000000 20 20 20 20 32 37 09 2a 20 44 61 74 61 73 68 65 | 27.* Datashe|
00000010 65 74 3a 20 53 4e 56 53 31 30 37 44 20 96 4a 55 |et: SNVS107D .JU|
00000020 4e 45 20 31 39 39 39 96 52 45 56 49 53 45 44 20 |NE 1999.REVISED |
00000030 4d 41 59 20 32 30 31 36 0d 0a |MAY 2016âŠ|
0000003a
I tried to track down the files from TI to see if they had this problem. I was not able to find anything from TI.
Once I fixed the file the simulation worked nicely.
Thanks for the report. Would you mind to file a bug report at Issues · KiCad / KiCad Source Code / kicad · GitLab ?
The model is in https://www.ti.com/de/lit/zip/snvmb27 from page LM2576 Datenblatt, Produktinformationen und Support | TI.com. It has this problem.
Obviously my Windows parser is not that critical.
I will exchange the LM2576_TRANS.LIB.
Done!
I had trouble with the following files in simulation examples repo. I am using the nightly docker container and the repo files:
./MAX9000/max9000_LT.lib
line 35 - legacy micro character (â”â) with hex value = 0xB5
./gain-ctrl-amp/vca810.lib
line 21 - some non-printables with hex value = 0x96.
I open the schematic and simulate. Those two wonât simulate. The FullBridge example (see below) will work when I open it and simulate. But if I edit the properties and re-specify the same spice file it breaks.
Unfortunately, for reasons I donât understand, it seems that even if I remove the exotic characters, FullBridge/2ED2109S06F_ng.lib doesnât work for me. After I select the file KiCad canât seem to parse the spice files.
When I remove the exotic characters from MAX9000/max9000_LT.lib and gain-ctrl-amp/vca810.lib, I am able to simulate things.
The nightly build I used doesnât provide much information about what has gone wrong.
Potentially non-UTF8 characters:
FullBridge/2ED2109S06F_ng.lib lines 44, 46, 67, 68, 72, 130, 132 and 135
MAX9000/max9000_LT.lib line 35
gain-ctrl-amp/vca810.lib line 21
I found this via a bash script that included
function Z { LC_ALL=C grep â[^[:cntrl:][:print:]]â ; }
function X { (cat -n $1 | Z > /dev/null) && (echo FAIL $1 ; cat -n $1 | Z && echo; cat $1 | Z | hexdump -C ; echo ); }
Here is some of the output.
FAIL ./FullBridge/2ED2109S06F_ng.lib
44 * INFINEONâS MODEL TERMS OF USE
46 * BY DOWNLOADING AND/OR USING THIS INFINEON MODEL (âMODELâ), THE USER
67 * 2.1 Infineon Technologies AG (âInfineonâ) is not and cannot be aware of the
âŠ
00000000 2a 20 49 4e 46 49 4e 45 4f 4e e2 80 99 53 20 4d |* INFINEONâŠS M|
00000010 4f 44 45 4c 20 54 45 52 4d 53 20 4f 46 20 55 53 |ODEL TERMS OF US|
00000020 45 0a 2a 20 42 59 20 44 4f 57 4e 4c 4f 41 44 49 |E.* BY DOWNLOADI|
âŠ
FAIL ./MAX9000/max9000_LT.lib
35 * single +2.5V to +5.5V supply and draw less than 500A of
00000000 2a 20 73 69 6e 67 6c 65 20 2b 32 2e 35 56 20 74 |* single +2.5V t|
00000010 6f 20 2b 35 2e 35 56 20 73 75 70 70 6c 79 20 61 |o +5.5V supply a|
00000020 6e 64 20 64 72 61 77 20 6c 65 73 73 20 74 68 61 |nd draw less tha|
00000030 6e 20 35 30 30 b5 41 20 6f 66 0a |n 500.A of.|
0000003b
FAIL ./gain-ctrl-amp/vca810.lib
21 * Datasheet: SBOS275F JUNE 2003REVISED DECEMBER 2010
00000000 2a 20 44 61 74 61 73 68 65 65 74 3a 20 53 42 4f |* Datasheet: SBO|
00000010 53 32 37 35 46 20 96 4a 55 4e 45 20 32 30 30 33 |S275F .JUNE 2003|
00000020 96 52 45 56 49 53 45 44 20 44 45 43 45 4d 42 45 |.REVISED DECEMBE|
00000030 52 20 32 30 31 30 0a |R 2010.|
00000037
Thanks very much!
You replied before I could finish my message to Hatte about the repo.
I didnât mean to bother you with more messages in this thread. I will add an issue in git.
Also, I just figured out that if I edit FullBridge/2ED2109S06F_ng.lib to try to fix things, even if I remove the exotic chars I canât seem to get it to simulate. If I just open up the project though and click simulate, it works.
I will be trying to move on use ngspice now instead of trying to track down the problem. I figured I should mention this to you in case it matters.
The repo by Hatte is just a (seemingly unmaintained) copy of my circuits presented here. So it is of no use to post any issues there.
Obviously the appearance of of non-UTF8 characters is a common âfeatureâ of commercial models. And KiCad cannot cope with this, at least on Linux (On my Windows it has been o.k.). So this is a KiCad bug. KiCad bug reports have to be placed at Issues · KiCad / KiCad Source Code / kicad · GitLab, following some specific format. Otherwise KiCad developers might not became aware of the problems.
I have uploaded a new 555 circuit example, this time switching to KiCad 9.