Skip to content

Proper support of slots in BXL-to-KiCAD - #7

Open
mefistotelis wants to merge 7 commits into
erichVK5:masterfrom
mefistotelis:master
Open

Proper support of slots in BXL-to-KiCAD#7
mefistotelis wants to merge 7 commits into
erichVK5:masterfrom
mefistotelis:master

Conversation

@mefistotelis

Copy link
Copy Markdown

These patches provide even better support of BXL files published by Texas Instruments.

After naming over 400 pins in a BGA device, I decided to update the conversion to convey proper BGA pin numbers, not just incrementing indexes. But while at it, I also noticed KiCAD has slots support, though they're named 'units' there. The converter even had some base elements of multi-slot symbols support, so I built on that.

Please check whether SYM files are generated correctly after this update - I don't even know what opens these. Since I changed the way pins are stored (from array to single object), it could have affected SYM format.

Updated kicad pin export so that it stores unit number
and electrical type from source.
Also updated kicad pin number to be set to source description field if
the description field happens to store BGA coordinates of the pin.
When no pins are defined in slot 0, the functions which return
bounding coordinates of pins will try a null dereference.

This fixes the dereference by using a global constant
as initial value for these functions.
This makes only one variable which stores slots/units number
remain. The additional one is unneccessary.
The slot property was added to SymbolElement, so that all
descending classes can store its slot index. Also removed
previous slot/unit index definition from SymbolPin.
The polyline KiCAD export algorithm was dividing polylines into separate
single lines. This may be useful, but is not always what user wants.
The patch introduces a class property to choose whether polyline should
be divided on export or not. It also adds proper inclusion of
slot/unit index into the resulting lines.
Functions fron the pins list array can now be used with slot index,
which alows dividing components into proper units during export.
Instead of creating separate symbol for each input slot, this patch
allows creating multi-slot/multi-unit KiCAD models. It uses slots
support introduced in previous patches, and provides more division
between exporting SYM files and KiCAD LIB files.
@erichVK5

Copy link
Copy Markdown
Owner

Nice work.

I will need to do some testing to ensure gschem (.sym) schematic symbols aren't broken.

I will put this onto my todo list, and integrate the changes once tested.

@dewhisna

dewhisna commented Feb 3, 2019

Copy link
Copy Markdown

@mefistotelis I like your enhancements, however, there seems to be an issue with composite components. It seems to be starting over its pin numbering on each sub-part within the .lib file, rather than preserving the pin numbers from the original part, which messes up the pin assignment.

So that you'll have it for your testing, the component I was trying to convert was
STM32F103VGTx.bxl.zip from STMicro's STM32F103VG page.

I liked the way the sub-parts were named better with your changes and the generally cleaner output, but I had to rollback my local merge of this pull-request to the original version @erichVK5 had to get a part with the correct pin numbers.

@dewhisna

dewhisna commented Feb 3, 2019

Copy link
Copy Markdown

Though I should also add, that the original version @erichVK5 had didn't do the sub-parts right either. It made them as three distinct parts rather than one part with three sub-parts, meaning KiCAD won't let you assign them to the same reference designator. So in that regard, @mefistotelis , your pull-request has better output. The only problem is that the pin numbers on the sub-parts are starting over rather than having the correct values.

I'm starting to look through this code to see if there's an easy fix, but I may (to get on with my circuit design) just manually tweak the output, merge what is correct from each version (since both are wrong), to get my library component for KiCAD.

@dewhisna

dewhisna commented Feb 3, 2019

Copy link
Copy Markdown

@mefistotelis Ah, I figured it out. The bestNumber code in SymbolPin.java was wrong. Instead of this:

    // In KiCAD, pin number is not neccessarily a number; it can also store BGA pin coords, A1-ZZ99
    String bestNumber = pinNumber;
    if (Pattern.matches("^[A-Za-z]{1,2}[0-9]{1,3}$", pinDesc))
        bestNumber = pinDesc;

    return ("X "
            + pinName + " " //  name displayed on the pin
            + bestNumber + " " // pin no. displayed on the pin, may be in col+row form
            + (kicadX + xOffset) + " " // Position X same units as the length

It should just be the pinDesc value in all cases as in the 49ffd46 commit by @erichVK5 which reads as:

    return ("X "
            + pinName + " " //  name displayed on the pin
            + pinDesc + " " // pin no. displayed on the pin, may be in col+row form.  Was pinNumber, but samarjit tells me this is wrong for BGA
            + (kicadX + xOffset) + " " // Position X same units as the length

If I change that part of SymbolPin.java, then everything seems to be completely correct for sub-parts and pin numbering.
I'll merge it that way on my fork so you can easily update this PR.

@erichVK5

erichVK5 commented Feb 4, 2019

Copy link
Copy Markdown
Owner

Good work chaps. I just need to ensure it does not break gschem .sym output.

@dewhisna

dewhisna commented Feb 4, 2019

Copy link
Copy Markdown

Thanks. I didn't see anything too broken in the .sym files, but yes, you should verify since I'm not totally sure what to look for, as I'm mainly after the .lib and .fp files. I opened a pull-request with @mefistotelis with these parts merged and once @mefistotelis verifies it on his end and merges that into his fork, it should automatically update this pull-request, which you can then merge once you have the .sym files verified.
Thanks again for creating this utility in the first place. It has proven very helpful!

@mefistotelis

Copy link
Copy Markdown
Author

I'd leave some checking sanity checking of pinDesc, ie. whether it contains at least one digit inside. But the change looks ok.

In the file I converted, the pin numbers were preceded by a letter; I assumed the use of pinDesc is mandatory only if the letter is there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants