Skip to content

BOM-8 LED swapped (polarity)

Severity Status Implementation
error runs in better_erc easy, depends on NET-5

Data it needs: graph, part classes, rails.

Looks at. LED pins (anode, cathode), rails and grounds (NET-5).

What it catches. An LED whose anode sits on the lower-potential side of its circuit: anode to ground, cathode to a rail, or cathode toward a high-side driver.

Why it matters. A reversed LED stays dark, and if the reverse voltage exceeds its rating (often 5 V) it can be damaged (RATE-24). Most often the symbol is right and the footprint's pad mapping or the assembly orientation is wrong (LIB-11, LAY-6); the schematic version of the mistake is the easy one to catch.

Example. A status LED drawn from GPIO through 1 kΩ with its anode on GND: the GPIO drives high, the LED is reverse-biased and dark.

How to check. For each LED, find which pin leads (through resistors) to a rail and which to ground or a driver; anode toward ground is a finding. The footprint side needs LIB-11. better_erc (erc_checks/src/bom/bom_8.rs) takes the fitted LEDs with pins named anode and cathode (A, K), walks from each through fitted two-pin resistors and ferrites (max_hops = 2) to the rails and grounds of NET-5, and reports an anode that reaches only ground or a negative rail, or a cathode that reaches only a rail. A cathode toward a high-side driver needs pin roles (NET-7).

Fix. Turn the LED in the schematic; check the footprint's pad 1 against the datasheet's cathode mark.

References. B135 rev C change list (pin-1 marks on D201, D601, D603); catalogue LIB-11, LAY-6, RATE-24.

Settings

Set them in the project file under [checks."BOM-8"], or for one run with --set BOM-8.NAME=VALUE.

Setting Default Meaning
BOM-8.max_hops 2 parts how many series resistors or ferrites the walk from an LED pin to a rail or ground goes through

Test schematics

Each schematic below is in test_schematics/sources. The block under it is what berc check --only BOM-8 reports on it.

bom-8_led_polarity

The test schematic bom-8_led_polarity The test schematic bom-8_led_polarity

  error      BOM-8 #7wg     LED D3 is reversed: cathode 1 leads to /+3V3
                            net /+3V3, part D3
                            class = LED (derived class from the library symbol)
                            fix: turn the LED round in the schematic, and check the footprint's pad 1 against the datasheet's cathode mark
  error      BOM-8 #zsq     LED D2 is reversed: anode 2 leads to /GND
                            net /GND, part D2
                            class = LED (derived class from the library symbol)
                            fix: turn the LED round in the schematic, and check the footprint's pad 1 against the datasheet's cathode mark