Allowed Characters in Pin Names

I just noticed that apparently during the 0.1.0 release(?) the period symbol (.) was disallowed in symbol pin names.

In a symbol I created pre-0.1.0, the name was changed from 3.3V to 33V. I cannot change it back.

On the other hand, for the signal name in the component, it was also changed from 3.3V to 33V, but I can change it to 3.3V again without an error message.

Why do we not allow the period in pin names? It’s just a string attribute, isn’t it?

If we decide to disallow it, what would be the convention for describing voltage levels? 3V3? Should the signal also match the pin name, or should 3.3V be used there?

As far as I remember, before the 0.1.0 release there was no restriction at all for pin and signal names. But I was not sure if this could lead to issues some time, so I restricted them to the regex [-a-zA-Z0-9_+/!?@#$]{1,32}.

For LibrePCB itself we don’t need this restriction, but we could get issues with exporters for SPICE netlists or pad attributes in the Gerber export if we allow characters which these other file formats don’t. So we should be very carefully with allowing more characters.

Hmm that should actually not be possible…

Yes, 3V3 is the most commonly used way to use voltages as pin/net names.

When I create a new component using the wizard and enter 3.3V for a signal, it is silently changed to 33V. After I added the signal, I can change it back to 3.3V. But it appears that it’s not saved (without an error message), since if I add another signal with the name 33V, LibrePCB complains that the signal with that name already exists. Furthermore, if I rename another signal, then the 3.3V signal name is again turned into 33V.

Okay that sounds like a bug :wink:

Alright, I’ll file an issue :slightly_smiling_face:

The reasoning with SPICE and other export formats makes sense. I was just confused that it was done inconsistently for pins and signals.

The reason we must disallow using . in signal names is that signals and instance names share the same namespace. If you have an instance name of R1 then you cannot have a signal that is also named R1.

When you support hierarchy you need to have a character that lets you reference something in a lower level.This is usually a period. So is signal foo inside instance U5 under instance U1.

The smaller your allowed character set is the less likely you are to run into trouble with future netlisters. Anything beyond a-zA-Z0-9-_ is risky. [] and () should be saved for dealing with vectors.

John Eaton

In the case of Nordic’s nRF5 series SoCs, their GPIO naming convention contains the period . symbol (e.g. P1.10).

Technically, that is the 10th IO on the GPIO P1 register, i.e. namespaced. Would this be an exception? or should i just use an alternative character?

Until there’s no better idea, I think you need to use an alternative character…

I would suggest to use P1_10.