Making a symbol / footprint for a ~100 pin module. - Page 1
Forum section: electronics / general

author: paulca
author_rank: Super Contributor
timestamp: February 17, 2023, 12:52:30 pm
content: The footprint worked out okay using the Array function to create the 2 sets of twin parallel headers, 44 pin each.I couldn't get KiCad to prefix them A and B so I ended up with 2 of each pin.I rummaged in the tool box and came back with some bash and perl:Code:cat MCUDev_STM32H7.kicad_mod | perl -e '$suf="B"; while(<STDIN>){ s/\(pad \"([0-9]+)\"/(pad \"${suf}${1}\"/g; print; if( $suf eq "A" ){ $suf = "B" }else{ $suf="A";} }' > MCUDev_STM32H7_2.kicad_modThis gave me two banks of 44 pins A1, A2, A3... B1, B2, B3. The 2.54mm spacing is easy. It looks like they have snapped the header to the edge cut, so, as long as my 2 banks are spaced correctly and the board is the right size it shouldfit.Then for the symbol. I added a few pins manually, thought, "sod that". Asked ChatGPT to do it for me and got bored watching it try in the old Kicad syntax and decided I could probably do it faster myself.I found the pin headers in text format, here:https://stm32-base.org/boards/STM32H743VIT6-STM32H7XX-MSo another rummage in the tool box and came back with PyCharm and Python.Code:import retemplate = """(pin unspecified line (at -2.54 {0!s} 0)(length 2.54)(name "{1!s}" (effects (font (size 1.27 1.27))))(number "A{2!s}" (effects (font (size 1.27 1.27)))))"""bank_a_string_lines = """13V3-+3.3V rail23V3-+3.3V rail3GND-Ground plane4GND-Ground plane5VDDA-VDDA6VREF+-VREF+7PB15-PB15.... SNIP.....44PE2-PE2"""bank_b_string_lines = """15V-+5V rail25V-+5V rail33V3-+3.3V rail43V3-+3.3V rail5GND-Ground plane6GND-Ground plane7PD9-PD9...SNIP...44PE0-PE0"""ypos = -2.54for line in bank_a_string_lines.splitlines():parts = re.split(r'[\t ]+', line)print(template.format(ypos, parts, parts))ypos = round(ypos-2.54,2)template = """(pin unspecified line (at 10.0 {0!s} 180)(length 2.54)(name "{1!s}" (effects (font (size 1.27 1.27))))(number "B{2!s}" (effects (font (size 1.27 1.27)))))"""ypos = -2.54for line in bank_b_string_lines.splitlines():parts = re.split(r'[\t ]+', line)print(template.format(ypos, parts, parts))ypos = round(ypos-2.54,2)That should get me started. The next thing I might need to script is adding the 90% of "Not connected" flags in the schematic.I still think it's easier than first finding an STM32H7 of the right flavour and creating the full schematic for it, and solder it etc. I already have a pretty compact set of modules that don't take up much more room than a bespoke layout, especially when I butcher it with 0805s and 10mm xtals.Just thought I'd share. I'm sure others come up with the sheer labour of making footprints and symbols for a large number of pins.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: February 17, 2023, 05:08:50 pm
content: When you create an array, there is a "Pad Numbering Scheme" and you can set it to use coordinates.If that does not work, then you can right click in the Footprint Editor and select "Renumber Pads". This lets you enter a prefix, and a starting pad number, and after that it requires one click per pad (with an automatic increment for each click).About the "No Connect" flags in the schematic. You can place one, and then keep the>key depressed. This activates a repeat function and you will get a column of No Connect flags. If you placed the first on a pin, then the next will be on the pin below it (or next to it, it's configurable). Quite often I find it easier though to just draw them in some empty area, and then use block move, drag and copy to move a bunch of those things. It's so quick that I do not see an advantage in scripting this. Therepeat function also works with labels, and it has an autoincrement, so you can label a whole adress (or data) bus with it very quickly. And again, I tend to draw them in some empty area. Like:1. Create one label with "D0" and put it somewhere.2. Depressuntill you have more then 8 labels ( or try to get exactly the amount you need).2a. You can also use the repeat function to draw wires and bus entries, so they also get included in the block.3. Drag a box around the amount of labels you need.4. Press[Ctrl + d]to Duplicate the block, and then put the whole block on some databus.5. Duplicate the block again to also put it in some other location.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: February 17, 2023, 05:53:27 pm
content: If you prefer the scripted approach...There is also:Footprint Editor / File / Create FootprintThis brings up a dialog in which you can select between some 15 different footprint generator scripts, and then enter some parameters to generate a custom footprint. These footprints are generated by python scripts, and these dwell somewhere in the installation. You can look these up and use them as a template to generate your own script.A lot of the default libraries in KiCad are also generated by scripts, but those are different scripts. I never looked at them, but they should not be hard to find on Gitlab.

author: paulca
author_rank: Super Contributor
timestamp: February 17, 2023, 08:08:23 pm
content: It eventually occurred to me that I need neither a footprint or a symbol.The module has 2 banks of dual row pin headers. 44 pins per header 88 pins.I can just put a similarly dimensioned pin header on the schematic. Set it to "not connected" and then label the pins I am using. I can do the pin header spacing in PCBNew.They "do" provide a .step file. And I accidentally created the symbol in the github repo I cloned with similar modules. I should at least "throw it over the fence" to that github repo before I delete it. The .step should be convertable back to a basic 3D model for KiCad... no idea.