saltylab-firmware/docs/wiring-diagram.md
sl-mechanical bfca6d1d92 docs: Add SAUL-TEE system reference + update wiring diagram
- docs/SAUL-TEE-SYSTEM-REFERENCE.md: authoritative architecture doc for
  the new 4-wheel wagon. Covers ESP32-S3 BALANCE (Waveshare LCD 1.28,
  QMI8658, SN65HVD230 CAN), ESP32-S3 IO (TBS Crossfire, ELRS, BTS7960,
  NFC/baro/ToF, WS2812), inter-board UART protocol (460800 baud,
  [0xAA][len][type][payload][crc8]), CAN IDs (VESCs 68/56, Orin
  0x300-0x303 cmd / 0x400-0x401 telemetry), RC channel map, power
  architecture, safety systems, and firmware layout.

- docs/wiring-diagram.md: banner pointing to new reference doc;
  old Mamba F722S UART summary marked OBSOLETE.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-04 08:25:24 -04:00

14 KiB
Raw Blame History

SaltyLab / SAUL-TEE Wiring Reference

⚠️ ARCHITECTURE CHANGE (2026-04-03): Mamba F722S / STM32 retired. New stack: ESP32-S3 BALANCE + ESP32-S3 IO + VESCs on 500 kbps CAN. Authoritative reference: docs/SAUL-TEE-SYSTEM-REFERENCE.md Historical STM32/Mamba wiring below is obsolete — retained for reference only.


System Overview (OBSOLETE — see SAUL-TEE-SYSTEM-REFERENCE.md)

┌─────────────────────────────────────────────────────────────────────┐
│                        ORIN NANO SUPER                              │
│                     (Top Plate — 25W)                               │
│                                                                     │
│  USB-C ──── STM32 CDC (/dev/stm32-bridge, 921600 baud)            │
│  USB-A1 ─── RealSense D435i (USB 3.1)                             │
│  USB-A2 ─── RPLIDAR A1M8 (via CP2102 adapter, 115200)             │
│  USB-C* ─── SIM7600A 4G/LTE modem (ttyUSB0-2, AT cmds + PPP)     │
│  USB ─────── Leap Motion Controller (hand/gesture tracking)        │
│  CSI-A ──── ArduCam adapter → 2× IMX219 (front + left)            │
│  CSI-B ──── ArduCam adapter → 2× IMX219 (rear + right)            │
│  M.2 ───── 1TB NVMe SSD                                            │
│  40-pin ─── ReSpeaker 2-Mic HAT (I2S + I2C, WM8960 codec)         │
│  Pin 8 ──┐                                                         │
│  Pin 10 ─┤ UART fallback to FC (ttyTHS0, 921600)                  │
│  Pin 6 ──┘ GND                                                     │
│                                                                     │
└─────────────────────────────────────────────────────────────────────┘
         │ USB-C (data only)              │ UART fallback (3 wires)
         │ 921600 baud                    │ 921600 baud, 3.3V
         ▼                                ▼
┌─────────────────────────────────────────────────────────────────────┐
│                     MAMBA F722S (FC)                                 │
│                  (Middle Plate — foam mounted)                       │
│                                                                     │
│  USB-C ──── Orin (CDC serial, primary link)                        │
│                                                                     │
│  USART2 (PA2=TX, PA3=RX) ──── Hoverboard ESC (26400 baud)         │
│  UART4  (PA0=TX, PA1=RX) ──── ELRS RX (CRSF, 420000 baud)        │
│  USART6 (PC6=TX, PC7=RX) ──── Orin UART fallback                  │
│  UART5  (PC12=TX, PD2=RX) ─── Debug (optional)                    │
│                                                                     │
│  SPI1 ─── MPU6000 IMU (on-board, CW270)                           │
│  I2C1 ─── BMP280 baro (on-board, disabled)                        │
│  ADC ──── Battery voltage (PC1) + Current (PC3)                    │
│  PB3 ──── WS2812B LED strip                                        │
│  PB2 ──── Buzzer                                                    │
│                                                                     │
└─────────────────────────────────────────────────────────────────────┘
         │ USART2                         │ UART4
         │ PA2=TX → ESC RX               │ PA0=TX → ELRS TX
         │ PA3=RX ← ESC TX               │ PA1=RX ← ELRS RX
         │ GND ─── GND                   │ GND ─── GND
         ▼                                ▼
┌────────────────────────┐    ┌──────────────────────────┐
│   HOVERBOARD ESC       │    │   ELRS 2.4GHz RX         │
│   (Bottom Plate)       │    │   (beside FC)             │
│                        │    │                            │
│  2× BLDC hub motors    │    │  CRSF protocol            │
│  26400 baud UART       │    │  420000 baud              │
│  Frame: [0xABCD]       │    │  BetaFPV 1W TX → RX      │
│  [steer][speed][csum]  │    │  CH3=speed CH4=steer      │
│                        │    │  CH5=arm   CH6=mode       │
└────────────────────────┘    └──────────────────────────┘
         │                              
    ┌────┴────┐                         
    ▼         ▼                         
  🛞 LEFT   RIGHT 🛞                    
  MOTOR     MOTOR                       


## Wire-by-Wire Connections

### 1. Orin ↔ FC (Primary: USB CDC)

| From | To | Wire Color | Notes |
|------|----|-----------|-------|
| Orin USB-C port | FC USB-C port | USB cable | Data only, FC powered from 5V bus |

- Device: `/dev/ttyACM0` → symlink `/dev/stm32-bridge`
- Baud: 921600, 8N1
- Protocol: JSON telemetry (FC→Orin), ASCII commands (Orin→FC)

### 2. Orin ↔ FC (Fallback: Hardware UART)

| Orin Pin | Signal | FC Pin | FC Signal |
|----------|--------|--------|-----------|
| Pin 8 | TXD0 | PC7 | USART6 RX |
| Pin 10 | RXD0 | PC6 | USART6 TX |
| Pin 6 | GND | GND | GND |

- Jetson device: `/dev/ttyTHS0`
- Baud: 921600, 8N1
- Voltage: 3.3V both sides (no level shifter needed)
- **Cross-connect:** Orin TX → FC RX, Orin RX ← FC TX

### 3. FC ↔ Hoverboard ESC

| FC Pin | Signal | ESC Pin | Notes |
|--------|--------|---------|-------|
| PA2 | USART2 TX | RX | FC sends speed/steer commands |
| PA3 | USART2 RX | TX | ESC sends feedback (optional) |
| GND | GND | GND | Common ground |

- Baud: 26400, 8N1
- Protocol: Binary frame — `[0xABCD][steer:int16][speed:int16][checksum:uint16]`
- Speed range: -1000 to +1000
- **Keep wires short and twisted** (EMI from ESC)

### 4. FC ↔ ELRS Receiver

| FC Pin | Signal | ELRS Pin | Notes |
|--------|--------|----------|-------|
| PA0 | UART4 TX | RX | Telemetry to TX (optional) |
| PA1 | UART4 RX | TX | CRSF frames from RX |
| GND | GND | GND | Common ground |
| 5V | — | VCC | Power ELRS from 5V bus |

- Baud: 420000 (CRSF protocol)
- Failsafe: disarm after 300ms without frame

### 5. Power Distribution

BATTERY (36V) ──┬── Hoverboard ESC (36V direct) │ ├── 5V BEC/regulator ──┬── Orin (USB-C PD or barrel jack) │ ├── FC (via USB or 5V pad) │ ├── ELRS RX (5V) │ ├── WS2812B LEDs (5V) │ └── RPLIDAR (5V via USB) │ └── Battery monitor ──── FC ADC (PC1=voltage, PC3=current)


### 6. Sensors on Orin (USB/CSI)

| Device | Interface | Orin Port | Device Node |
|--------|-----------|-----------|-------------|
| RealSense D435i | USB 3.1 | USB-A (blue) | `/dev/bus/usb/...` |
| RPLIDAR A1M8 | USB-UART | USB-A | `/dev/rplidar` |
| IMX219 front+left | MIPI CSI-2 | CSI-A (J5) | `/dev/video0,2` |
| IMX219 rear+right | MIPI CSI-2 | CSI-B (J8) | `/dev/video4,6` |
| 1TB NVMe | PCIe Gen3 ×4 | M.2 Key M | `/dev/nvme0n1` |


## FC UART Summary (MAMBA F722S — OBSOLETE)

| UART | Pins | Baud | Assignment | Notes |
|------|------|------|------------|-------|
| USART1 | PB6=TX, PB7=RX | — | SmartAudio/VTX | Unused in SaltyLab |
| USART2 | PA2=TX, PA3=RX | 26400 | Hoverboard ESC | Binary motor commands |
| USART3 | PB10=TX, PB11=RX | — | Available | Was SBUS default |
| UART4 | PA0=TX, PA1=RX | 420000 | ELRS RX (CRSF) | RC control |
| UART5 | PC12=TX, PD2=RX | 115200 | Debug serial | Optional |
| USART6 | PC6=TX, PC7=RX | 921600 | Jetson UART | Fallback link |
| USB CDC | USB-C | 921600 | Jetson primary | `/dev/stm32-bridge` |


### 7. ReSpeaker 2-Mic HAT (on Orin 40-pin header)

| Orin Pin | Signal | Function |
|----------|--------|----------|
| Pin 12 (GPIO 18) | I2S BCLK | Audio bit clock |
| Pin 35 (GPIO 19) | I2S LRCLK | Audio left/right clock |
| Pin 38 (GPIO 20) | I2S DIN | Audio data in (from mics) |
| Pin 40 (GPIO 21) | I2S DOUT | Audio data out (to speaker) |
| Pin 3 (GPIO 2) | I2C SDA | WM8960 codec control (i2c-7) |
| Pin 5 (GPIO 3) | I2C SCL | WM8960 codec control (i2c-7) |
| Pin 32 (GPIO 12) | GPIO | Button input |
| Pin 11 (GPIO 17) | GPIO | RGB LED (APA102 data) |
| Pin 2, 4 | 5V | Power |
| Pin 6, 9 | GND | Ground |

- **Codec:** Wolfson WM8960 (I2C addr 0x1A)
- **Mics:** 2× MEMS (left + right) — basic stereo / sound localization
- **Speaker:** 3W class-D amp output (JST connector)
- **Headset:** 3.5mm TRRS jack
- **Requires:** WM8960 device tree overlay for Jetson (community port)
- **Use:** Voice commands (faster-whisper), wake word (openWakeWord), audio feedback, status announcements

### 8. SIM7600A 4G/LTE HAT (via USB)

| Connection | Detail |
|-----------|--------|
| Interface | USB (micro-B on HAT → USB-A/C on Orin) |
| Device nodes | `/dev/ttyUSB0` (AT), `/dev/ttyUSB1` (PPP/data), `/dev/ttyUSB2` (GPS NMEA) |
| Power | 5V from USB or separate 5V supply (peak 2A during TX) |
| SIM | Nano-SIM slot on HAT |
| Antenna | 4G LTE + GPS/GNSS (external SMA antennas — mount high on chassis) |

- **Data:** PPP or QMI for internet connectivity
- **GPS/GNSS:** Built-in receiver, NMEA sentences on ttyUSB2 — outdoor positioning
- **AT commands:** `AT+CGPS=1` (enable GPS), `AT+CGPSINFO` (get fix)
- **Connected via USB** (not 40-pin) — avoids UART conflict with FC fallback, flexible antenna placement
- **Use:** Remote telemetry, 4G connectivity outdoors, GPS positioning, remote SSH/control

### 10. Leap Motion Controller (USB)

| Connection | Detail |
|-----------|--------|
| Interface | USB 3.0 (micro-B on controller → USB-A on Orin) |
| Power | ~0.5W |
| Range | ~80cm, 150° FOV |
| SDK | Ultraleap Gemini V5+ (Linux ARM64 support) |
| ROS2 | `leap_motion_ros2` wrapper available |

- **2× IR cameras + 3× IR LEDs** — tracks all 10 fingers in 3D, sub-mm precision
- **Mount:** Forward-facing on sensor tower or upward on Orin plate
- **Use:** Gesture control (palm=stop, point=go, fist=arm), hand-following mode, demos
- **Combined with ReSpeaker:** Voice + gesture control with zero hardware in hand

### 11. Power Budget (USB)

| Device | Interface | Power Draw |
|--------|-----------|------------|
| STM32 FC (CDC) | USB-C | ~0.5W (data only, FC on 5V bus) |
| RealSense D435i | USB-A | ~1.5W (3.5W peak) |
| RPLIDAR A1M8 | USB-A | ~2.6W (motor on) |
| SIM7600A | USB | ~1W idle, 3W TX peak |
| Leap Motion | USB | ~0.5W |
| ReSpeaker HAT | 40-pin | ~0.5W |
| **Total USB** | | **~6.5W typical, ~10.5W peak** |

Orin Nano Super delivers up to 25W — USB peripherals are well within budget.

---

## Data Flow

                ┌──────────────┐
                │  ELRS TX     │ (in your hand)
                │  (2.4GHz)    │
                └──────┬───────┘
                       │ radio
                ┌──────▼───────┐
                │  ELRS RX     │ CRSF 420kbaud
                └──────┬───────┘
                       │ UART4
          ┌────────────▼────────────┐
          │      MAMBA F722S        │
          │                         │
          │  MPU6000 → Balance PID  │
          │  CRSF → Mode Manager   │
          │  Safety Monitor         │
          │                         │
          └──┬──────────┬───────────┘
USART2 ─────┘          └───── USB CDC / USART6
26400 baud                    921600 baud
     │                              │
     ▼                              ▼

┌────────────────┐ ┌───────────────────┐ │ Hoverboard ESC │ │ Orin Nano Super │ │ │ │ │ │ L motor R motor│ │ SLAM / Nav2 / AI │ │ 🛞 🛞 │ │ Person following │ └────────────────┘ │ Voice commands │ │ 4G telemetry │ └──┬──────────┬───────┘ │ │ ┌──────────▼─┐ ┌────▼──────────┐ │ ReSpeaker │ │ SIM7600A │ │ 2-Mic HAT │ │ 4G/LTE + GPS │ │ 🎤 🔊 │ │ 📡 🛰️ │ └────────────┘ └───────────────┘