Closed bug report

EAGLE export strips a prime from pin names, so QH' becomes QH@2

Ray · ·closed by Colby Knox

What happens adom-lbr generate passes every pin name through eagle_safe_name (src/main.rs, around line 879). That function keeps only ASCII letters, digits and _ + - . / ! @ $ #. A prime (ASCII ', U+02BC ʼ, U+2032 ′) becomes _, and the trailing _ is then trimmed. So QH' becomes QH. When another pin is already called QH, dedup_pin_names (around line 917) renames the second one QH@2. EAGLE and Fusion read @n as "another pad of the same pin", so the schematic shows two pins labelled QH. The netlist is still right, because each connect names its own pad. Only the labels are wrong.

Example: Panasonic EVQ-P7A01P (adom/evq-p7a01p) Pins are 1, 1', 2, 2', with names 1, 1ʼ, 2, 2ʼ (U+02BC, as Panasonic prints them). The .lbr connects read:

  • pin 1 on pad 1
  • pin 1@2 on pad 1'
  • pin 2 on pad 2'
  • pin 2@2 on pad 2

So in Fusion the pin labelled "2" is on pad 2'. This is harmless on this part, because 1/1' and 2/2' are each one internal node. It is not harmless on the parts below.

Where it matters: different signals that differ only by the prime

  • 74HC595 family: QH (pad 7, last parallel output) and QH' (pad 9, serial output to the next chip) come out as QH and QH@2. The serial output is labelled QH.
  • CD4521B: VDD/VSS and VDD'/VSS' are separate supply pins, and come out as VDD@2 and VSS@2.
  • 74HC4094: QS' comes out as QS@2.

Count Factory-built component pages (factory page folders on two hosts): 111 have a prime in a pin name or number. On 40 of them the stripped name collides with another pin, which gives the mislabel above. These are 36 x 74xx594/595/596 (QH'), 2 x CD4521B (VDD', VSS'), 1 x M74HC4094 (QS') and EVQ-P7A01P (1ʼ, 2ʼ). On the other 71 there is no collision, and the name only loses the prime: X'tal becomes X_tal on crystals, and Q1' becomes Q1 on CD74HC4024/4040.

Repro (adom-lbr 2.47.9, source 2509eb6)

adom-wiki repo clone adom/sn74hc595n && adom-lbr generate --sym sn74hc595n/sn74hc595n.kicad_sym --fp sn74hc595n/sn74hc595n.kicad_mod -o /tmp/595.lbr && grep -o 'pin="QH[^"]*" pad="[0-9]*"' /tmp/595.lbr

Result: pin="QH" pad="7" and pin="QH@2" pad="9". Lint passes, so nothing flags it.

Suggested fix In eagle_safe_name, map a prime to a visible, EAGLE-legal mark before the charset pass, instead of dropping it. For example, ', ʼ and ′ could map to _P (QH' to QH_P, 1ʼ to 1_P), or to ! overbar notation if the prime means "complement" in that datasheet (it does not for QH'). A trailing _ that came from a prime should not be trimmed. Then dedup_pin_names never sees a false duplicate. It would also help if lint flagged a pin whose @n name came from a stripped character rather than a real repeated name.

1 Reply

Colby Knox ·

Fixed in 2.47.10, along the lines you suggested.

A prime that ends a name or a word (', ʼ U+02BC, ′ U+2032, and ’ U+2019, which some datasheets use) now becomes _P instead of being dropped. QH' becomes QH_P, 1ʼ becomes 1_P, and VDD' becomes VDD_P. An apostrophe inside a word is not a prime, so X'tal still becomes X_tal. Unnamed pins that fall back to their pad number get the same treatment, so a pin numbered 1' becomes 1_P. (Before, the raw 1' was used, which lint would have rejected.)

On your examples:

  • sn74hc595n: pin="QH" pad="7" and pin="QH_P" pad="9" (was QH@2).
  • evq-p7a01p: 1 on pad 1, 1_P on pad 1', 2_P on pad 2', 2 on pad 2.

For the flag: lint only sees the .lbr, and there a real GND@2 and one made by a collision look the same. So the check runs in generate instead. When two different source names end up as the same EAGLE name, it prints WARN: [pin-name-collision] with both names. Repeats of the same name (GND, GND) still become @n without a warning.

The 40 colliding pages keep their old pin names until they are regenerated. On the 71 pages without a collision, regenerating only changes names (Q1 becomes Q1_P, while X_tal stays as it is).

Colby Knox closed this ·

Log in to reply.