VESC IDs 61/79 were from a now-reverted #735 refactor; hardware uses 56/68. RPM_PER_STEER_UNIT=3 is needed by drive_task for left/right differential. Display BL/RST already correct (GPIO15/16 CAN, GPIO2/14 display per schematic). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
48 lines
2.1 KiB
C
48 lines
2.1 KiB
C
#pragma once
|
||
|
||
/* ── ESP32-S3 BALANCE board — Waveshare ESP32-S3-Touch-LCD-1.28 pinout ─────
|
||
*
|
||
* Orin comms: CH343 USB-to-serial on UART0 (GPIO43/44) → /dev/ttyACM0 on Orin
|
||
* VESC CAN: SN65HVD230 transceiver on GPIO15 (TX) / GPIO16 (RX)
|
||
* Display: GC9A01 on SPI2 — BL=GPIO2, RST=GPIO14 (Waveshare schematic-verified)
|
||
*/
|
||
|
||
/* ── Orin serial (CH343 USB-to-UART, 1a86:55d3 on Orin side) ── */
|
||
#define ORIN_UART_PORT UART_NUM_0
|
||
#define ORIN_UART_BAUD 460800
|
||
#define ORIN_UART_TX_GPIO 43 /* ESP32 UART0 TX → CH343 RXD */
|
||
#define ORIN_UART_RX_GPIO 44 /* CH343 TXD → ESP32 UART0 RX */
|
||
#define ORIN_UART_RX_BUF 1024
|
||
#define ORIN_TX_QUEUE_DEPTH 16
|
||
|
||
/* ── Inter-board UART (ESP32 BALANCE ↔ ESP32 IO) ── */
|
||
#define IO_UART_TX_GPIO 17
|
||
#define IO_UART_RX_GPIO 18
|
||
|
||
/* ── VESC CAN TWAI (SN65HVD230 on Waveshare header GPIO15/16) ── */
|
||
#define VESC_CAN_TX_GPIO 15 /* ESP32 TWAI TX → SN65HVD230 TXD */
|
||
#define VESC_CAN_RX_GPIO 16 /* SN65HVD230 RXD → ESP32 TWAI RX */
|
||
#define VESC_CAN_RX_QUEUE 32
|
||
|
||
/* VESC node IDs */
|
||
#define VESC_ID_A 56u /* FRONT VESC — drive + telemetry (0x81) */
|
||
#define VESC_ID_B 68u /* RIGHT VESC — drive + telemetry (0x82) */
|
||
|
||
/* ── GC9A01 240×240 round display (Waveshare ESP32-S3-Touch-LCD-1.28, SPI2) ── */
|
||
#define DISP_DC_GPIO 8
|
||
#define DISP_CS_GPIO 9
|
||
#define DISP_SCK_GPIO 10
|
||
#define DISP_MOSI_GPIO 11
|
||
#define DISP_RST_GPIO 14
|
||
#define DISP_BL_GPIO 2
|
||
|
||
/* ── Safety / timing ── */
|
||
#define HB_TIMEOUT_MS 500u /* heartbeat watchdog: disarm if exceeded */
|
||
#define DRIVE_TIMEOUT_MS 500u /* drive command staleness timeout */
|
||
#define TELEM_STATUS_PERIOD_MS 100u /* 10 Hz status telemetry to Orin */
|
||
#define TELEM_VESC_PERIOD_MS 100u /* 10 Hz VESC telemetry to Orin */
|
||
|
||
/* ── Drive → VESC RPM scaling ── */
|
||
#define RPM_PER_SPEED_UNIT 5 /* speed_units=1000 → 5000 ERPM */
|
||
#define RPM_PER_STEER_UNIT 3 /* steer differential: left=spd+str, right=spd-str */
|