Skip to content

chore(rmcs_board): Raise UART0 baudrate for temporary debugging#55

Open
qzhhhi wants to merge 2 commits into
mainfrom
dev/baudrate-921600
Open

chore(rmcs_board): Raise UART0 baudrate for temporary debugging#55
qzhhhi wants to merge 2 commits into
mainfrom
dev/baudrate-921600

Conversation

@qzhhhi
Copy link
Copy Markdown
Member

@qzhhhi qzhhhi commented May 20, 2026

摘要

本 PR 临时将串口波特率提高到 921600 bps 以便调试;实际改动同时包含对 RMCS 控制板上的 UART0(软件层)和 C_Board 上的 USART6(硬件 HAL)波特率的修改。注意:PR 标题和 commit 信息存在不一致——PR 标题/分支名指向 UART0,但 commit 信息提到 UART1(USART6)。

修改内容摘要

  • firmware/rmcs_board/app/src/uart/uart.hpp
    • 将 uart_array 中 data::DataId::kUart0 的初始化波特率由 115200 → 921600(Uart::Lazy{ data::DataId::kUart0, kBoardConfigs[0], 921600, parity_none })。
  • firmware/c_board/bsp/cubemx/Core/Src/usart.c
    • 在 MX_USART6_UART_Init() 中将 huart6.Init.BaudRate 从 115200 → 921600(仅波特率变更,其他初始化字段与错误处理保持不变)。
  • firmware/c_board/bsp/cubemx/rmcs_slave.ioc
    • 将 USART6 的配置新增/更新为包含 BaudRate=921600(并在 IPParameters 中加入 BaudRate 项)。

影响与注意事项

  • 运行时影响:提高波特率用于临时调试,可能影响兼容性与稳定性;请仅在需要时使用。
  • 一致性问题:源码层面同时修改了 UART0(软件映射)和 USART6(硬件),请确认目标板上两者的对应关系以避免混淆。
  • 评论中建议(来自提交者):
    • 在将使用该固件的设备上启用 dangerously_skip_version_check。
    • 使用该固件时将 librmcs 包版本固定为 3.2.0rc0(必需)。

变更范围

  • 仅波特率参数被修改;导出接口/函数签名未改变。

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5d12f5c6-1557-44c0-bb3d-ceb64e95f311

📥 Commits

Reviewing files that changed from the base of the PR and between af772a9 and 973454f.

📒 Files selected for processing (2)
  • firmware/c_board/bsp/cubemx/Core/Src/usart.c
  • firmware/c_board/bsp/cubemx/rmcs_slave.ioc

Walkthrough

将 UART0 的初始化波特率从 115200 更新为 921600,并同步更新 STM32 CubeMX 配置和生成的 USART6 HAL 初始化代码以匹配该速率。

Changes

UART 波特率同步修改

Layer / File(s) Summary
MCU/CubeMX 与 HAL 初始化
firmware/c_board/bsp/cubemx/rmcs_slave.ioc, firmware/c_board/bsp/cubemx/Core/Src/usart.c
在 CubeMX 配置中为 USART6 添加 BaudRate=921600 并将 MX_USART6_UART_Init() 中的 huart6.Init.BaudRate 设置为 921600
固件层 UART0 初始化
firmware/rmcs_board/app/src/uart/uart.hpp
uart_arraykUart0Uart::Lazy 初始化参数的波特率由 115200 修改为 921600

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Alliance-Algorithm/librmcs#33: 之前的 PR 修改了 firmware/rmcs_board/src/uart/uart.hpp 中为各 UART 指定波特率的相关代码,和本次对 kUart0 波特率的更改在代码路径上相关联。

Poem

兔子轻蹦在串口边,
波特飞升九二一,
数据奔跑像细流,
帧帧跃过草与天,
小耳听得通信甜。 🐰

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive PR标题提到'UART0',但实际修改涉及C板的USART6(UART1)和RMCS板的UART0,标题仅反映部分变更且与提交信息不一致。 建议将标题改为更准确地反映所有修改内容,如'chore: Raise UART baudrate to 921600 for temporary debugging',或者根据主要目标明确指出是C板还是RMCS板的修改。
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev/baudrate-921600

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@qzhhhi
Copy link
Copy Markdown
Member Author

qzhhhi commented May 20, 2026

在需要使用该固件的板上开启 dangerously_skip_version_check。
使用该固件必须将 librmcs 版本固定在 3.2.0rc0,切记,切记!

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@firmware/rmcs_board/app/src/uart/uart.hpp`:
- Line 143: Uart::Lazy is currently hardcoded with 921600 for
data::DataId::kUart0 (kBoardConfigs[0]) which is a temporary debug baud and
breaks existing tools; change the default back to 115200 and make the baud
configurable via a centralized constant or macro (e.g. UART_DEFAULT_BAUD or
BOARD_UART_BAUD) so the Uart::Lazy initializer uses that symbol instead of the
magic literal 921600, and update any related docs or config header where board
serial defaults are defined.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8f864a0b-50f9-4120-8ef9-fbc63d6c5311

📥 Commits

Reviewing files that changed from the base of the PR and between aaaface and af772a9.

📒 Files selected for processing (1)
  • firmware/rmcs_board/app/src/uart/uart.hpp


inline constinit Uart::Lazy uart_array[]{
Uart::Lazy{data::DataId::kUart0, kBoardConfigs[0], 115200, parity_none},
Uart::Lazy{data::DataId::kUart0, kBoardConfigs[0], 921600, parity_none},
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

避免把“临时调试”波特率直接固化为主线默认值

Line 143 将 UART0 默认波特率改为 921600,会直接改变既有串口工具/上位机(若仍按 115200)的连通性契约。既然这是临时调试用途,建议改为可切换配置(宏或集中常量),主线默认保持 115200。

💡 建议改法(示例)
+constexpr uint32_t kUart0Baudrate =
+#ifdef RMCS_UART0_DEBUG_BAUD_921600
+    921600;
+#else
+    115200;
+#endif
+
 inline constinit Uart::Lazy uart_array[]{
-    Uart::Lazy{data::DataId::kUart0, kBoardConfigs[0], 921600, parity_none},
+    Uart::Lazy{data::DataId::kUart0, kBoardConfigs[0], kUart0Baudrate, parity_none},
     Uart::Lazy{data::DataId::kUart1, kBoardConfigs[1], 115200, parity_none},
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@firmware/rmcs_board/app/src/uart/uart.hpp` at line 143, Uart::Lazy is
currently hardcoded with 921600 for data::DataId::kUart0 (kBoardConfigs[0])
which is a temporary debug baud and breaks existing tools; change the default
back to 115200 and make the baud configurable via a centralized constant or
macro (e.g. UART_DEFAULT_BAUD or BOARD_UART_BAUD) so the Uart::Lazy initializer
uses that symbol instead of the magic literal 921600, and update any related
docs or config header where board serial defaults are defined.

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

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant