Skip to content

Apply user UART baudrate setting to permanent UART port on dual-UART boards#896

Open
FelixvdDonk wants to merge 1 commit intovedderb:masterfrom
FelixvdDonk:user_baudrate_dual_uart
Open

Apply user UART baudrate setting to permanent UART port on dual-UART boards#896
FelixvdDonk wants to merge 1 commit intovedderb:masterfrom
FelixvdDonk:user_baudrate_dual_uart

Conversation

@FelixvdDonk
Copy link
Copy Markdown
Contributor

Problem

On hardware with two UART ports (e.g. Flipsky 75100, 75100_V2, and many others), the permanent UART port (UART_PORT_BUILTIN) ignores the user-configured baudrate setting (app_uart_baudrate). It is always stuck at the hardcoded HW_UART_P_BAUD value (typically 115200), regardless of what the user sets in VESC Tool.

Root cause

In app_set_configuration(), the configure call for the permanent UART passed 0 as the baudrate:

app_uartcomm_configure(0, appconf.permanent_uart_enabled, UART_PORT_BUILTIN);

Since app_uartcomm_configure() skips baudrate updates when the value is 0, the permanent port was locked to its hardware default forever.

Fix

Pass appconf.app_uart_baudrate to the permanent UART — but only when the board's HW_UART_P_BAUD matches the default APPCONF_UART_BAUDRATE (115200). This ensures boards that intentionally set a non-standard permanent baud for dedicated peripherals (e.g. Unity at 250000 for BLE, A200S V4 at 1000000 for logger) are not affected.

app_uartcomm_configure(
    (HW_UART_P_BAUD == APPCONF_UART_BAUDRATE) ? appconf.app_uart_baudrate : 0,
    appconf.permanent_uart_enabled, UART_PORT_BUILTIN);

Impact

  • Boards with HW_UART_P_BAUD == 115200 (~45 boards): permanent UART now respects user baudrate setting. No behavioral change unless the user explicitly changes the baudrate.
  • Boards with custom HW_UART_P_BAUD (Unity, A200S V4/V4.1): zero change in behavior.
  • Affected hardware includes: Flipsky 75100, 75100_V2, FSESC 75_300, 75_200_ALU, MakerBase 75_100, Trampa 60/HD, and all other dual-UART boards using the default 115200 permanent baud.> app_uartcomm_configure(0, appconf.permanent_uart_enabled, UART_PORT_BUILTIN);
Since `app_uartcomm_configure()` skips baudrate updates when the value is `0`, the permanent port was locked to its hardware default forever.

**Fix**

Pass `appconf.app_uart_baudrate` to the permanent UART — but only when the board's `HW_UART_P_BAUD` matches the default `APPCONF_UART_BAUDRATE` (115200). This ensures boards that intentionally set a non-standard permanent baud for dedicated peripherals (e.g. Unity at 250000 for BLE, A200S V4 at 1000000 for logger) are not affected.

```c
app_uartcomm_configure(
    (HW_UART_P_BAUD == APPCONF_UART_BAUDRATE) ? appconf.app_uart_baudrate : 0,
    appconf.permanent_uart_enabled, UART_PORT_BUILTIN);

Impact

  • Boards with HW_UART_P_BAUD == 115200 (~45 boards): permanent UART now respects user baudrate setting. No behavioral change unless the user explicitly changes the baudrate.
  • Boards with custom HW_UART_P_BAUD (Unity, A200S V4/V4.1): zero change in behavior.
  • Affected hardware includes: Flipsky 75100, 75100_V2, FSESC 75_300, 75_200_ALU, MakerBase 75_100, Trampa 60/HD, and all other dual-UART boards using the default 115200 permanent baud.

Applies a conditional baud rate setting for the built-in UART.

This ensures the application's configured baud rate is only used if it matches the hardware's permanent UART baud rate. Otherwise, the port is configured with a baud rate of 0 to prevent conflicts or misconfiguration on specific hardware variants.
@FelixvdDonk
Copy link
Copy Markdown
Contributor Author

FelixvdDonk commented Mar 26, 2026

I'm not too familiar with the way the secondary uart is configured and how costly it is on the MCU. I'm in the position where i need the second port of the Flipsky 75100 to go to a higher baudrate (1500000 baud) but I can't do it currently in the vesc tool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant