From 9b4a31aa6650387425f3232b94d600abc55b52c3 Mon Sep 17 00:00:00 2001 From: Sebastien Vayrette Date: Mon, 20 Apr 2026 11:48:43 -0400 Subject: [PATCH] fix: Init TWAI before UART0 to prevent GPIO 43/44 pin conflict UART0 init was claiming GPIO 43/44 before TWAI could use them for CAN. Swapping init order ensures TWAI gets GPIO 43/44 (where the SN65HVD230 transceiver is physically wired per Waveshare board design). Co-Authored-By: Claude Opus 4.6 --- esp32s3/balance/main/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esp32s3/balance/main/main.c b/esp32s3/balance/main/main.c index 7858c25..518aa11 100644 --- a/esp32s3/balance/main/main.c +++ b/esp32s3/balance/main/main.c @@ -114,9 +114,9 @@ void app_main(void) { ESP_LOGI(TAG, "ESP32-S3 BALANCE bd-66hx starting"); - /* Init peripherals */ - orin_serial_init(); + /* Init CAN FIRST — TWAI must claim GPIO 43/44 before UART0 can grab them */ vesc_can_init(); + orin_serial_init(); /* TX queue for outbound serial frames */ s_orin_tx_q = xQueueCreate(ORIN_TX_QUEUE_DEPTH, sizeof(orin_tx_frame_t));