erichVK5 / BXL2text

A utility to convert huffman encoded BXL schematic and footprint files to plain text, gEDA PCB (.fp) and gschem (.sym), and KiCad (.lib) formats
GNU General Public License v2.0
22 stars 9 forks source link

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

Open mefistotelis opened 6 years ago

mefistotelis commented 6 years ago

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.

erichVK5 commented 6 years ago

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 commented 5 years ago

@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 commented 5 years ago

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 commented 5 years ago

@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 49ffd4629b64fb78a8a1530a9ee93a77f897bd72 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 commented 5 years ago

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

dewhisna commented 5 years ago

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 commented 5 years ago

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.