Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't handle many Microchip provided Ultralibrarian files #1

Open
issus opened this issue Oct 23, 2020 · 0 comments
Open

Doesn't handle many Microchip provided Ultralibrarian files #1

issus opened this issue Oct 23, 2020 · 0 comments

Comments

@issus
Copy link
Owner

issus commented Oct 23, 2020

Many symbols from Microchip are not parsed correctly, which causes them not to show any pin labels.

We can open a bxl package and look at the pins with:

var data = BxlDocument.ReadFromFile(fileName, BxlFileType.FromExtension, out var logs);

            var result = new List<Package>();

            foreach (var symbol in data.Symbols)
            {
                var package = new Package(symbol.Name);

                package.Pins.AddRange(
                    symbol.Data
                        .Where(d => d is LibPin && 
                            (d as LibPin).Name.Text.ToUpperInvariant() != "NC" &&
                            (d as LibPin).Name.Text.ToUpperInvariant() != "DNC")
                        .Select(d => d as LibPin)
                        .Select(d => new Pin(d.Designator.Text, d.Name.Text))
                    );

                result.Add(package);
            }

Example file: PIC18C452-X_P and many others in https://www.microchip.com/mymicrochip/filehandler.aspx?ddocname=en537519
(PIC18 CAD/CAE Schematic Symbols @ https://www.microchip.com/development-tools/reference-designs/cad-cae-symbols if that link does not work)

This shows the pins with numbers, but with no name.

This is because BXL files are not always consistent apparently. They can sometimes have the name on the Component rather than the symbol pin.

Currently, the way we read pins is:

  • iterate over the Components
  • then to get the symbols, iterate the Component's AttachedSymbols

So as it's a nested loop, for those cases where the pin has no name you could fall back to the Component's Pins

I think it can get the proper pin matching the Symbol's Pin PinNum with the Component's Pin SymPinNum, the descriptor should match but I wouldn't bet on that for all cases.

component.Pins.First(compPin => p.SymPinNum == pin.PinNum)

If the current method does not have a value for the Name property, it should try to match as above.

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

No branches or pull requests

1 participant