Skip to content

MUX-1 SCL goes to a pin named SCL, MISO to MISO etc

Severity Status Implementation
error runs in better_erc easy, depends on IMP-1

Data it needs: graph, part classes.

Looks at. Net names, pin names.

What it catches. A net whose name carries an interface signal (SCL, SDA, MISO, MOSI, TX, RX, D+) landing on a pin whose name carries a different one: SDA on an SCL pin, MISO on MOSI, TX on TX.

Why it matters. Swapped I2C lines, SPI data lines or UART TX/RX are the most common board bring-up bug and the cheapest to catch: the schematic tells you twice what each wire is. The catch is UART and SPI naming: TX → RX across parts is correct, and SPI pin names on a peripheral may be from its own point of view (SDI, SDO, DIN).

Example. A sensor's SDA pin on the net I2C1_SCL because the symbol pins were drawn in the other order than the MCU's: the bus never acknowledges, and the scope shows clock on the data line.

How to check. Normalise signal names on nets and pins (IMP-1); I2C and clock signals must match, UART TX must meet RX, SPI MOSI/SDO of the controller must meet MOSI/SDI of the peripheral, and a pin with an alternate-function list (NET-12) is matched against all of its names. better_erc (erc_checks/src/mux/mux_1.rs, the signal grammar in erc_analysis::names) reads the I2C, SPI, USB and CAN signal a named net carries (I2C1_SCL, SPI_MOSI, USB_D+, CAN_H) and every pin on it by all its names: the pin name split at / (PB6/I2C1_SCL), the alternate chosen and the symbol's alternates. A pin whose names carry signals of the net's interface, none of them the net's, is a finding; SDI, SDO, DIN and DOUT fit either SPI data net, since they are named from the part's side. UART is judged pin against pin, because a net named TX may be named from either end: TX pins of two parts on one net, or RX pins of two parts with no TX and no connector to bring one, are findings; connector and test point pins are left out. Alternate functions from part data (NET-12) will add the MCU pins whose symbols list none.

Fix. Swap the connection, or rename the net if the name is the error.

References. The interface specs per bus; I2C for bus checks that build on this one.

Test schematics

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

mux-1_swapped_signals

The test schematic mux-1_swapped_signals The test schematic mux-1_swapped_signals

  error      MUX-1 #eb0     net /I2C1_SCL (SCL) lands on U2.4 SDA (SDA)
                            net /I2C1_SCL, part U2
                            fix: swap the connection, or rename the net if the name is the error
  error      MUX-1 #027     net /I2C1_SDA (SDA) lands on U2.3 SCL (SCL)
                            net /I2C1_SDA, part U2
                            fix: swap the connection, or rename the net if the name is the error
  error      MUX-1 #pk5     net /SPI_MISO (MISO) lands on U3.4 MOSI (MOSI)
                            net /SPI_MISO, part U3
                            fix: swap the connection, or rename the net if the name is the error
  error      MUX-1 #hwx     net /SPI_MOSI (MOSI) lands on U3.5 MISO (MISO)
                            net /SPI_MOSI, part U3
                            fix: swap the connection, or rename the net if the name is the error
  error      MUX-1 #em6     net /UART_RX: RX pins meet with no TX: nothing drives the line (U1.9 PA10/USART1_RX, U4.4 RX)
                            net /UART_RX, part U1, part U4
                            fix: cross the UART: TX of one part to RX of the other
  error      MUX-1 #t0a     net /UART_TX: TX pins of two parts meet: both drive the line (U1.8 PA9/USART1_TX, U4.3 TX)
                            net /UART_TX, part U1, part U4
                            fix: cross the UART: TX of one part to RX of the other

MUX-1 also fires on the test schematics of other checks: dbg-11_uart_spi_resistors, name-4_uart_names, short-12_pair_halves_tied.