7 Commits

Author SHA1 Message Date
Sebastien Vayrette
8e66430c86 fix: CAN on GPIO 15/16, UART IO on 17/18 — actual hardware wiring
Tee confirmed physical wiring on Waveshare ESP32-S3 board:
- GPIO 15 = CAN TX (SN65HVD230 TXD)
- GPIO 16 = CAN RX (SN65HVD230 RXD)
- GPIO 17/18 = inter-board UART to ESP32 IO

Previous configs (GPIO 2/1, 43/44) were spec assumptions that didn't
match the actual board wiring. GPIO 43/44 are internal to PCB, not
on the header where the transceiver is connected.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-20 12:17:39 -04:00
330c2ab4fe feat: GC9A01 display driver + SAULT/voltage HUD; fix UART GPIO regression
- gc9a01.c/h: GC9A01 240x240 round LCD SPI driver (SPI2, GPIO 9-14)
  5x7 bitmap font with scaling, display_fill_rect/draw_string/draw_arc
- main.c: hud_task — "SAULT" orange header (scale=3) + battery voltage
  white on black (scale=4), updates at 1 Hz from g_vesc[0].voltage_x10
- config.h: add DISP_* GPIO defines; revert 06219af UART regression —
  lsusb on Orin confirms /dev/ttyACM0 = CH343 (1a86:55d3) wired to
  GPIO 43/44, not native USB; UART must stay on 43/44, CAN stays on 2/1
  (SN65HVD230 physical rewire to GPIO 2/1 still required for CAN to work)
- CMakeLists.txt: add gc9a01.c

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-20 11:51:14 -04:00
Sebastien Vayrette
06219afe69 fix: Move CAN TWAI to GPIO 43/44 where transceiver is actually wired
Diagnostic proved UART protocol works (ACKs received) but CAN has zero
communication. Root cause: ESP32 connects to Orin via USB Serial/JTAG
(CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y), NOT UART0 on GPIO 43/44.
The SN65HVD230 CAN transceiver is still physically on GPIO 43/44
(original pre-bd-66hx wiring was never changed).

Fix: Put TWAI on GPIO 43/44 where the transceiver actually is.
Move unused UART0 pin config to GPIO 17/18 to avoid conflict.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-20 11:38:44 -04:00
Sebastien Vayrette
dd52982a03 feat: Motor test firmware — orin_serial, sdkconfig, CMakeLists cleanup, tilt config
- orin_serial: tighten packet framing, add RX stats
- sdkconfig.defaults: strip unused components for faster build
- CMakeLists.txt: condense SRCS list, drop redundant REQUIRES
- config.h: add TILT_CUTOFF_DEG 25.0f
- vesc_can.h: add tx/rx error counters extern declarations
- main.c: clarify file-header comment, log bd-66hx at startup

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-20 10:43:08 -04:00
Sebastien Vayrette
bdbd7a7c3e fix: Restore correct VESC CAN IDs (56/68) in config.h
A linter reverted VESC_ID_A/B to old values 61/79. Correct IDs per
bd-wim1 protocol are 56 (left) and 68 (right).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-19 22:43:47 -04:00
Sebastien Vayrette
b0abc7a90d fix: Strip OTA and balance-safety code for motor test firmware
Remove all OTA subsystem (gitea_ota, ota_self, uart_ota, ota_display)
and balance-bot safety checks (tilt cutoff, BAL_TILT_FAULT) so the
firmware builds without cJSON/WiFi/HTTP dependencies. Core UART protocol,
VESC CAN drive, differential steering, and PID tuning remain intact.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-19 22:43:24 -04:00
b830420efc feat: add UART/USB serial protocol for Orin comms, proxy VESC CAN (bd-66hx)
Replaces Orin↔ESP32-S3 BALANCE CAN comms (0x300-0x303 / 0x400-0x401)
with binary serial framing over CH343 USB-CDC at 460800 baud.

Protocol matches bd-wim1 (sl-perception) exactly:
  Frame: [0xAA][LEN][TYPE][PAYLOAD][CRC8-SMBUS]
  CRC covers LEN+TYPE+PAYLOAD, big-endian multi-byte fields.

Commands (Orin→ESP32): HEARTBEAT/DRIVE/ESTOP/ARM/PID
Telemetry (ESP32→Orin): TELEM_STATUS, TELEM_VESC_LEFT (ID 56),
                         TELEM_VESC_RIGHT (ID 68), ACK/NACK

VESC CAN TWAI kept for motor control; drive commands from Orin
forwarded to VESCs via SET_RPM. Hardware note: SN65HVD230
rewired from IO43/44 to IO2/IO1 to free IO43/44 for CH343.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-17 22:09:12 -04:00