KiCAD Hierarchical Labels

Hey Guys,

I’ve stumbled upon a question whilst laying out an ebike controller regarding hierarchical labels, specifically for power labels. I have a top level schematic that looks likes the following:

As you can see, on the top level, they’re connected to a global net (the +3.3v and GND). Now, inside the block I’m not sure whether to use multiple labels inside, to keep the hierarchial nature, like so:

Or, tie these to global nets inside the sheet, but this is kind of redundant because they’re already declared global on the top sheet, like this:

I prefer this method, as I can keep the inputs on the left, outputs on the right, and group the power supplies - but I think I read that this loses some of the hierarchical ideas. The other option is to not pass through the PSUs, and use the global nets, but this totally loses the hierarchical idea.

Do you guys have any thoughts? Does it really matter, it terms of readability? I understand they’re all functionally the same (at least, I think). This is a home project, and not related to work or anything, but I might open source the idea and I just generally would like to know too.

Thanks in advance!

Max

The convention of GND at bottom, VCC at top, and IO on sides is of course the “right” way to do it, but I’m personally not religious about that. I’m pretty sure that you’re free to do whatever you want, but I experienced yesterday that I actually had to pass the power pins into the hierarchical sheets for the DRC to be happy?

The general idea with hierarchical sheets is reuse, so it kind of makes sense to have the power pins be part of the input pins to a sheet, given that you could in theory use a different VCC in a different design? (since many parts can use 2.5V, 3V3 and up to 5v?)

1 Like

Hello Max,

I draw hierarchical schematics and use global power ports. I treat top sheets as block diagrams that show how functional blocks are connected. Showing the power and return wiring clutters the top sheet and generally doesn’t help the reader to understand the circuit.

I think your top sheet is clear, but I would remove the +3V3 and GND ports and just use globals. I think the +BATT net is useful as it shows the HV supply, but I would rename all the ports to be the same, instead of +BATT, VIN and +48V.

On individual schematic sheets, I connect ICs to a global power connector via one or more decoupling capacitors. By drawing the capacitor close to the IC and connecting with a short wire, it shows the intention to place the capacitor physically close to the IC on the PCB.

I don’t think it is very readable to use a bus to carry SPI signals. The reader needs to mentally map SPI1_SCK to SD-SPI_2 and back again at the MCU. This leaves room for error when checking the schematic or writing the firmware. Altium has wiring harnesses to group signals together while keeping meaningful names, I don’t know if KiCAD has this functionality.

On the top sheet, I would make the MCU sheet much taller and have discrete SPI and I2C wires directly to the SD CARD and LCD blocks (assuming you don’t have a wiring harness).

Cheers,
James

1 Like

I would agree with this for this schematic, especially for the 3.3V rail, as it is not the heart of the circuit. The +48V rail, as you have shown, might be better to keep separate, because it is central to the motor driver that you are working on.

Regarding the specifics, I would say for you to keep those nets as either global or heirarchical, and not both, because then it would get confusing.

1 Like

Hey everyone,

Thank you very much for the advice - it seems like the most popular method is having the non important voltages as nets, and so I’ve gone with this method, hopefully this is what you guys were recommending:

I’ve kept the ground symbol, instead of naming it a net (it just makes more sense to me) but I’ve now used nets for the 3v3 - and I pass these through the blocks and simply connect them in the upper left, for readability.

Thanks very much for the help!

1 Like

Readability (avoidiing mistakes for you, and clarity of intent when communicating to others) is the ONLY purpose of a schematic - otherwise just create a netlist by hand! :wink:

Btw, inputs enter on left, outputs exit to right (although likely a western cultural bias).

However, there is never one right way to draw a circuit, some drawings will be better than others, and it’s up to you to decide when one is good enough given the purpose, expectations, and how much time you can spend.

1 Like

I suspect the size of the project matters here. If you have a design with 50+ pages of schematics, being more rigorously structured matters more than if it’s a 3 or 4 page design where you can more easily absorb the entire design in your head.

It’s easier to spot net connectivity issues on smaller designs. At some point, you take the necessary overhead to doing things more formally so that you can rely on the process to help keep you out of trouble.

2 Likes

Reiterating what some others have said, the schematic is about communicating function. And then, there’s some amount of doing that in a way that the tool can perform effective/helpful ERC. From the perspective of someone reading the schematic, the use of the hierarchical pins and nets would lead me to believe that there is something specific about the power net that is happening in these hierarchical sheets (e.g. redundant 3v3 rails OR’d together, multiple phases, fusing, or something). But, except for one spot, there isn’t…it’s just a global power net.

From a KiCAD ERC perspective, using the “power flag” on relevant nets in combination with setting symbol supply pins as “power input”, “power output”, etc is really solid and useful for ensuring supply rails are driven by something (e.g. mark the global power rail with the power flag at the connector).

My personal preference on a more complicated board, is to only use the hierarchical pins for the power path before global supply rails are being generated. An example from a power path sheet: some sort of unregulated rail in, [a miracle occurs], global supply nets are driven.

Elsewhere in the schematic, I would just use the global power symbols. The ERC will catch the case where I use a power symbol that isn’t driven (either because it actually isn’t driven, or I used the wrong symbol name, etc).

4 Likes

3 posts were split to a new topic: Extracting connections from hierachical sheet to main sheet

I generally am a bit of a purist with regards to hierarchical design. Possibly because of my software engineering background. For me a hierarchical sheet is just an object with a defined interface.
Global labels which include power symbols do not really fit this view for me. They introduce knowledge dependencies to something outside the current scope (so outside the current sheet).

I do also not see an issue with placing the same label multiple times inside a sheet. I would however wish there was a hierarchical pin type for “power pin” or possibly even a way to have custom shapes like we have for power symbols (but distinct enough to easily differentiate them from global power symbols).

I am excited about the new bus features that come with version 6. These will make my workflow even cleaner. (will allow similar schematics to how some FPGA programming tools look like)

For the interested i have written up my general view of things over on the kicad forum FAQ: https://forum.kicad.info/t/hierarchical-or-flat-schematic-design-what-is-best-for-me-how-to-deal-with-multi-page-schematics/16477

1 Like