Skip to content
Back to skills

Interfaces And Protocols

ASecurity

This skill should be used when the user connects chips, boards or devices over a wired interface and needs wiring, termination, protection or debugging for SPI, I2C, 1-Wire, I2S, UART, RS-232 / 485, Modbus RTU, CAN, LIN, USB and USB-C, Ethernet, level shifting, isolation, connectors or ESD. It gives pin-to-pin wiring and calculators for I2C pull-ups, CAN bit timing, UART baud error and RS-485 buses. Load it before answering a wiring or bus question, even a short one, because its tables and ca...

  • 3 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 1, 2026
ai-agentsnodedebugginggit

Works with

  • mcp

Security analysis

A100/100

Pro scans all 14 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add gkochievi/boulder-hardware-skills --skill interfaces-and-protocols --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Interfaces And Protocols?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Interfaces And Protocols
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gkochievi-interfaces-and-protocols/badge)](https://www.skillsdirectory.com/skills/gkochievi-interfaces-and-protocols)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: interfaces-and-protocols
description: This skill should be used when the user connects chips, boards or devices over a wired interface and needs wiring, termination, protection or debugging for SPI, I2C, 1-Wire, I2S, UART, RS-232 / 485, Modbus RTU, CAN, LIN, USB and USB-C, Ethernet, level shifting, isolation, connectors or ESD. It gives pin-to-pin wiring and calculators for I2C pull-ups, CAN bit timing, UART baud error and RS-485 buses. Load it before answering a wiring or bus question, even a short one, because its tables and calculators carry the sourced limits.
user-invocable: false
---

# Interfaces and protocols: buses, ports and cables

Connect parts and boxes so the link works on the bench and in the field: pick the interface for the distance, speed, node count and noise, wire it pin to pin, terminate and protect it, lay it out, and bring it up with numbers instead of guesses. Logic levels and the one-page bus overview stay in `electronics-fundamentals/references/digital-interfaces.md`; logic analysers, SocketCAN, Modbus tools and bus debugging stay in `embedded-firmware/references/bus-tools.md`; modules (RS-485, CAN, Ethernet boards) in `peripherals/references/communication-modules.md`. This skill holds the depth.

## Procedure

1. **Choose the interface** from `references/wiring-connectors-and-protection.md` section 1 (length × rate × nodes × noise × ground). Inside one enclosure on one ground: I2C or SPI. Beyond about 1 m: differential (RS-485, CAN, Ethernet, USB) or a dedicated extender. Between separately powered boxes or near motors and contactors: isolate.
2. **Wire it pin to pin.** Use the wiring table of the matching reference for ESP32, STM32, AVR or RP2040. Check every level: a 5 V device on a 3.3 V MCU needs a translator or a part with 3.3 V-compatible thresholds (`electronics-fundamentals/references/digital-interfaces.md`).
3. **Compute, do not guess:**
   - I2C pull-ups for the real bus capacitance: `scripts/i2c_pullup.py --vdd 3.3 --mode fm --cb 200` (or `--devices N --trace-pf X --cable-pf Y`).
   - UART divider and two-end baud error: `scripts/uart_baud.py --mcu stm32 --clock 64e6 --baud 115200`.
   - RS-485 termination, failsafe bias, unit loads, rate × length: `scripts/rs485_bus.py --supply 3.3 --bitrate 115200 --length 300 --nodes 10 --ul 1` (`--ul` is the unit load of one transceiver; at 3.3 V the bias resistors alone cost about 36 unit loads, so expect a warning unless the transceivers are failsafe: `--ul 0.125 --failsafe-receivers`).
   - CAN bit timing with register values: `scripts/can_bittiming.py --controller mcp2515 --clock 16e6 --bitrate 500000`.
   All four print a readable report, take `--json`, read a `[<script>]` section of `boulder.toml`, and exit 0 ok, 1 check failed, 2 usage error. They never guess a clock, a bitrate or a supply: give them.
4. **Terminate and protect at the connector:** RS-485 and CAN termination at both ends only, bias at one node, a TVS that stays off over the bus's legal range (asymmetric −7/+12 V for RS-485, 24 V class for CAN), ESD parts with low capacitance on USB and Ethernet pairs, and the protection capacitance counted in the signal budget.
5. **Lay it out** with the reference's PCB section: differential pairs together at their impedance (90 Ω USB, 100 Ω Ethernet, 120 Ω RS-485/CAN cable), transceiver close to the connector, protection between connector and transceiver, no split planes under fast lines (`pcb-design/references/stackups-and-routing.md`).
6. **Bring it up in order:** power and idle levels with a meter, then a logic analyser on the bus (`embedded-firmware/references/bus-tools.md`), then the firmware example from the reference, then error counters and stress (cable length, noise, many nodes). Use each reference's troubleshooting table before changing hardware.

## Defaults and traps

- **SPI:** know the mode (CPOL/CPHA) from the device timing diagram, keep CS high during reset, and give every device that may not release MISO (microSD) its own bus or a buffer. Add 22–33 Ω series resistors at the driver on fast or long clock lines.
- **I2C:** one set of pull-ups per bus segment, sized for rise time with `i2c_pullup.py`; check every address against every other device; plan bus recovery (nine clocks) and a reset path. Clock stretching breaks on some masters (`references/spi-i2c-1wire-i2s.md` section 3).
- **1-Wire:** 4.7 kΩ pull-up for short runs; strong pull-up during DS18B20 conversion in parasitic mode; long lines need the AN148 topologies or a DS2482 bridge.
- **UART:** both ends together within the receiver tolerance; never assume 115200 works from every clock (`uart_baud.py`); 3.3 V MCU pins are not RS-232.
- **RS-485:** 120 Ω at both physical ends, nothing in the middle; failsafe bias at one node or failsafe transceivers (on 3.3 V buses the bias costs unit loads, see `rs485_bus.py`); a reference conductor with the pair; drive DE from hardware (UART DE pin or auto-direction part) when timing matters.
- **CAN:** 120 Ω (or 2 × 60 Ω split with a capacitor) at both ends; 3.3 V MCUs use a transceiver with a VIO pin or a 3.3 V transceiver; sample point near 87.5 % for classic CAN at common rates; an 8 MHz MCP2515 cannot run 1 Mbit/s.
- **USB:** device-side USB-C needs a separate 5.1 kΩ Rd on each CC pin; D+/D− as a 90 Ω pair with ESD at the connector; a VID/PID you are allowed to use.
- **Ethernet:** RMII needs a clean 50 MHz reference; on ESP32 decide the clock source before the pin map (GPIO0 strapping); magnetics per the PHY datasheet.
- **Isolation:** an isolator without an isolated supply on the far side isolates nothing.

These defaults summarise the references; where a reference gives conditions or disagreeing sources, follow the reference.

## References

| File | Use for |
|---|---|
| `references/spi-i2c-1wire-i2s.md` | SPI modes, CS timing, shared buses and SD cards, daisy chains, QSPI/Octal, clock vs trace length; I2C limits per mode (UM10204), pull-ups, clock stretching, addresses, TCA9548A, bus recovery, level shifting (BSS138, PCA9306, LSF, TXS vs TXB), PCA9615 / P82B715 long runs, SMBus, I3C; 1-Wire timing, parasite power, long lines, DS2482, ROM CRC; I2S / TDM / PDM; wiring tables and C examples |
| `references/uart-rs232-rs485.md` | UART frame, baud generators and receiver tolerance, DMA and idle-line receive, flow control; RS-232 (MAX3232, DE-9); RS-422 vs RS-485, termination, failsafe bias, unit loads, stubs, cable and ground, rate vs length, DE/RE direction control, isolation, surge, connectors; Modbus RTU essentials; DMX512 in brief; wiring tables, layout, parts |
| `references/can-and-lin.md` | CAN physical layer, transceivers with VIO and mode pins, termination and topology, ESD/TVS, bit timing and oscillator tolerance, CAN FD and TDC, STM32 bxCAN / FDCAN, ESP32 TWAI, MCP2515 / MCP2518FD, error handling, frames and filters, CANopen / J1939 pointers, LIN physical layer and frames; wiring tables, layout, parts |
| `references/usb-and-ethernet.md` | USB 2.0 full-speed device hardware, series resistors per MCU, ESD, VBUS sensing; USB-C sink and source resistors, CC thresholds, PD sink chips, host VBUS switching, device classes, VID/PID; Ethernet MAC + RMII PHY (50 MHz clock, ESP32 GPIO0, straps, MDIO), magnetics, W5500, PoE powered devices; wiring, firmware, layout |
| `references/wiring-connectors-and-protection.md` | choosing an interface (length × rate × nodes × noise), connector families and ratings (JST PH/XH/SH/GH, Qwiic / STEMMA QT), wire gauge and voltage drop, crimping, shielding and grounding, ground loops, level translation summary, galvanic isolation, ESD and surge per interface, cable types, hot-plugging, long-cable rules |

## Scripts

| Script | Computes |
|---|---|
| `scripts/i2c_pullup.py` | allowed pull-up range per UM10204 for VDD, bus capacitance and mode; recommended E24 value; rise time and low-level current for a chosen resistor; fails when nothing fits |
| `scripts/uart_baud.py` | divider registers and actual baud for AVR (U2X), STM32 (OVER8/16), ESP32, RP2040 or a generic divider; two-end error against the receiver tolerance |
| `scripts/rs485_bus.py` | termination, failsafe bias resistors for a supply, idle differential voltage, unit-load budget, rate × length check, stub length, resistor power |
| `scripts/can_bittiming.py` | every valid BRP / TSEG1 / TSEG2 / SJW set for STM32 bxCAN, STM32 FDCAN (both phases), ESP32 TWAI and MCP2515 (with CNF1–3), the best one, oscillator tolerance and a propagation check |

## Circuit blocks

The KiCad generator has ready blocks for an RS-485 port and a CAN port (`kicad-generator/references/circuit-blocks.md`): transceiver, termination jumper, bias option, TVS and connector, checked in KiCad 10.

## Related skills

- `electronics-fundamentals`: logic levels, pull-ups and level translation basics.
- `embedded-firmware`: drivers, DMA, RTOS use, and bench debugging with `embedded-firmware/references/bus-tools.md` and `embedded-firmware/scripts/can_tool.py`.
- `peripherals`: modules that sit on these buses.
- `pcb-design`: differential routing, ESD and surge parts, EMC at the connector.
- `iot-systems`: Modbus and CAN gateways to MQTT.

## Next step

When this is done, say what comes next: `kicad-generator` for the circuit block of the bus, `pcb-design` for protection and routing at the connector, `embedded-firmware` for the driver.

Files in this skill

  • SKILL.md9.2 KB
  • references/can-and-lin.md37.2 KB
  • references/spi-i2c-1wire-i2s.md43.9 KB
  • references/uart-rs232-rs485.md42.7 KB
  • references/usb-and-ethernet.md32.4 KB
  • references/wiring-connectors-and-protection.md27.7 KB
  • scripts/can_bittiming.py32.3 KB
  • scripts/i2c_pullup.py26.7 KB
  • scripts/rs485_bus.py24.5 KB
  • scripts/tests/test_can_bittiming.py8.7 KB
  • scripts/tests/test_i2c_pullup.py12.2 KB
  • scripts/tests/test_rs485_bus.py6 KB
  • scripts/tests/test_uart_baud.py8.4 KB
  • scripts/uart_baud.py32.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.