Author Topic: Making a symbol / footprint for a ~100 pin module.  (Read 1243 times)

0 Members and 1 Guest are viewing this topic.

Offline paulcaTopic starter

  • Super Contributor
  • ***
  • Posts: 4247
  • Country: gb
Making a symbol / footprint for a ~100 pin module.
« on: February 17, 2023, 12:52:30 pm »
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: [Select]
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_mod

This 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 should
 fit.

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-M

So another rummage in the tool box and came back with PyCharm and Python.

Code: [Select]
import re
template = """
(
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 = """1 3V3 - +3.3V rail
2 3V3 - +3.3V rail
3 GND - Ground plane
4 GND - Ground plane
5 VDDA - VDDA
6 VREF+ - VREF+
7 PB15 - PB15
.... SNIP.....
44 PE2 - PE2
"""
bank_b_string_lines = """1 5V - +5V rail
2 5V - +5V rail
3 3V3 - +3.3V rail
4 3V3 - +3.3V rail
5 GND - Ground plane
6 GND - Ground plane
7 PD9 - PD9
...SNIP...
44 PE0 - PE0
"""
ypos = -2.54
for line in bank_a_string_lines.splitlines():
    parts = re.split(r'[\t ]+', line)
    print(template.format(ypos, parts[1], parts[0]))
    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.54
for line in bank_b_string_lines.splitlines():
    parts = re.split(r'[\t ]+', line)
    print(template.format(ypos, parts[1], parts[0]))
    ypos = round(ypos-2.54,2)
[/size]

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.
"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 

Online Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3830
  • Country: nl
Re: Making a symbol / footprint for a ~100 pin module.
« Reply #1 on: February 17, 2023, 05:08:50 pm »
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 >[Ins] 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. The  [Ins] repeat 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. Depress [Ins] untill 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.
 
The following users thanked this post: paulca

Online Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3830
  • Country: nl
Re: Making a symbol / footprint for a ~100 pin module.
« Reply #2 on: February 17, 2023, 05:53:27 pm »
If you prefer the scripted approach...

There is also: Footprint Editor / File / Create Footprint This 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.
 
The following users thanked this post: paulca

Offline paulcaTopic starter

  • Super Contributor
  • ***
  • Posts: 4247
  • Country: gb
Re: Making a symbol / footprint for a ~100 pin module.
« Reply #3 on: February 17, 2023, 08:08:23 pm »
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.

"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf