Creating symbols for complex devices with multifunctional pins

I have read

From the Library Conventions, this seems clear for simpler devices where one pin has one function

Where possible, pins should be grouped by similar function, rather than by their physical location on the associated footprint. This provides cleaner schematic routing and symbols are easier to understand in the schematic.

I am trying to create a symbol for PJRC Teensy 4.1 where each pin can be configured multiple ways pinout PDF. For example pin 24 could be analog input A10, or serial TX6, or I2C SCL2, or a PWM output.

I had started using an existing symbol, which does not use logical grouping but simply numbers the pins, 1 to 24 on one side and 25 to 49 on the other. But that doesn’t actually correspond to the physical layout, either! Teensy 4.1 is compatible with Teensy 4.0 (and before that, Arduino I think). Teensy 4.0 is shorter, so it has 14 pins on each side [pinout PDF}(https://www.pjrc.com/teensy/card10a_rev2_web.pdf) labelled GND, 0, 1 and so on to 12, then 13 on the other side up to 23 and then three power pins.

To be compatible with that, Teensy 4.1 has GND, 0, 1 and so on to 12, then another power pin, then 24 to 32. On the other side 33 to 41, GND, and (in the same physical positions as Teensy 4.0) 13 to 23, etc.

So the symbol I have been using does not correspond to either the logical or the physical layout, and the pin numbers do not correspond to the device pin numbers either (Teensy pin 1 (TX1) is numbered 3 on the symbol, because the numbering starts at 1. This caused me to lose a bunch of time during schematic capture because I was making incorrect assumptions about how the pins were numbered.

So: making a set of separate symbols for each possible pin usage seems cumbersome and effectively would mean one symbol per project. Thus, I am considering making a symbol that corresponds to the actual physical layout and to the Teensy pin numbering.

On to my actual questions:

Do pins on a KiCad symbol all have to be numbered, and do they have to be sequential? Or can I make a symbol where the first pin is called GND, the second 0, the third 1 and so on?

This is the existing symbol

and here is the physical pin numbering

To be clear, I am looking for advice on best practices. I am not asking anyone to make me a symbol.

It is like each microcontroller. Each pin can be input/output or UART driven or analog input.
So see how microcontroller symbols are defined.

Where from the idea of being corresponding to physical layout?
Schematic need not to have anything common with physical layout. See OpAmp or NAND symbols.

Searching in RepoRecon for KiCad and “teensy” finds about 100 results. That looks like a simple start to begin for your own schematic symbol.

KiCad matches schematic pins with footprint pads solely based on the “pin number”. They do not have to be sequential, they do not even have to be numbers. BGA packages for example use a combination of letters and numbers similar to chessboard coordinates, and there are plenty of BGA’s with gaps in their pad “numbering”.

The symbol editor makes it easy to move, mirror and rotate a block of pins, or to sort them later. Most data can be entered more conveniently in the pin table.

Relatively new in KiCad are the alternative pin function definitions. Listing all the pin functions in the symbol such as in the screenshot from svgeesus is “old fashioned”. In newer KiCad versions (I think it was introduced in V7) you can define all the alternative pin assignments in the symbol:

And then, when this symbol is used in the schematic, you can change the pin function from the list.

All the STM32 uC’s have these defined. Those symbols are created from a (python) script, probably from some xml database. The script is part of KiCad and can be found on gitlab, but I never looked into details.

1 Like

Wow thanks, that is super helpful. Lots to did into, there.