20260928-1330-key-two-expansion-buses Give Key two expansion paths: I2C expansion units and an internal CAN bus
- status: completed
- createdAt: 2026-09-28 13:30
- approvedAt: 2026-09-28 13:30 (owner: "用 A 扩展单元和 CAN 扩展两种方案来做")
- relatedTask: 20260928-1330-key-two-expansion-buses
Context
章节标题:“Context”Key R0.3 (uncommitted) expands through I2C expansion units behind an 8-channel I2C switch: up to eight units, 72 keys, harness of about 0.3 m per port. The owner asked for longer reach and for an expansion link that does not interfere with the external bus. Three links were compared (LCSC retail, 2026-09-28, controller, transceiver and LED driver per eight keys):
| I2C with switch | RS-485 | Internal CAN | |
|---|---|---|---|
| Cost per eight keys | 0.85–1.26 | 0.85–0.95 | 1.7–2.0 |
| Reach | 0.3 m, about 2 m with shielded twisted pair and reduced speed | tens of metres | tens of metres |
| Key reporting | interrupt and read | polled by the master | pushed by the unit |
| Error handling | none | to be written | built into CAN |
| Protocol | none needed | fully custom | X01 frame formats can be reused |
| Firmware on the unit | none | yes | yes |
The ESP32-C6 has two TWAI controllers; the second was already reserved. Datasheet figures used: MCP-free design, TJA1042 / SIT1042 class transceivers at 0.44–0.49, CH32V203 with CAN at 0.71–1.03, isolated transceivers ISO1042 / CA-IS3050 at 1.2–1.5 and an isolated DC-DC at 0.75.
Proposal
章节标题:“Proposal”Two expansion paths on the base unit, usable together:
- I2C expansion units (no MCU): unchanged from the current text, up to eight, for boards in the same assembly.
- CAN expansion units: a small CAN MCU, a CAN transceiver and an LED driver per unit, on an internal CAN bus driven by TWAI1 through its own transceiver; design target 16 units and a 20 m bus. Units push key events; the base unit is the only X01 node and the only gateway.
New requirement KEY-22 separates the two CAN buses. KEY-21 is widened to both expansion paths. Open items: KEY-O-12 for the internal CAN protocol, enumeration, bit rate, termination, the update of expansion firmware and the connector keying; galvanic isolation is recorded as an option for separately powered expansion panels, not part of the first version. The design records that a CAN expansion unit fitted with a TJA1463 is electrically a radio-less Key and could sit on the YBO CAN as an independent node; whether that becomes a product configuration is left to KEY-O-11.
Risks
章节标题:“Risks”- A second firmware image (expansion MCU) enters the product; low-cost CAN MCUs have no hardware root of trust. The unit holds no keys and only reports key events and displays state, and SEC-05 has to say how its image is verified by the base unit before activation.
- Two four-wire CAN harnesses on one product invite mis-plugging; connectors must differ.
- The internal transceiver adds a few milliamps to the base unit's static current, which stays inside the 20 mA limit only with little margin; it is enabled only when CAN expansion units are configured.
- The base unit remains a single point of failure for everything behind it.
Scope
章节标题:“Scope”Key spec, design, guide, brief, index, evaluation; line spec and line index; product plan; open questions; changelog.
Alternatives
章节标题:“Alternatives”- RS-485 as the long-reach link. Cheaper by about one USD per unit but needs a custom polled protocol and its latency grows with the unit count; recorded, not adopted.
- Only one path. I2C alone cannot reach distant panels; CAN alone makes every near unit carry an MCU and firmware. The owner chose both.
Annotations
章节标题:“Annotations”- 2026-09-28 13:30 (owner): "用 A 扩展单元和 CAN 扩展两种方案来做". Implemented as spec R0.4, design R0.4 and guide R0.5 because R0.3 was committed as 68fc761 in the meantime.