Skip to content

fix(firmware/rmcs_board): Configure UART pins with internal pull-up to prevent floating#52

Merged
qzhhhi merged 1 commit intomainfrom
fix/uart-pullup
May 6, 2026
Merged

fix(firmware/rmcs_board): Configure UART pins with internal pull-up to prevent floating#52
qzhhhi merged 1 commit intomainfrom
fix/uart-pullup

Conversation

@qzhhhi
Copy link
Copy Markdown
Member

@qzhhhi qzhhhi commented May 6, 2026

文件变更概览

本 PR 修改了 Lite 和 Pro 两个版本的 UART 初始化代码,主要涉及以下两个文件:

  • firmware/rmcs_board/boards/lite/app/board_app.cpp
  • firmware/rmcs_board/boards/pro/app/board_app.cpp

具体修改内容

两个文件的共同变更:

  1. 头文件调整

    • 添加了 #include <hpm_common.h> 头文件
  2. init_uart 函数修改

    • 移除了 tx_padrx_pad 常量定义,这两个常量包含了拉高和施密特触发器配置
    • 删除了所有 UART 引脚的 PAD_CTL 设置操作

Lite 版本具体变更:

  • 从 UART0、UART2、UART7 的初始化代码中删除了所有 PAD_CTL 配置设置
  • 保留了 FUNC_CTL 的功能配置和 GPIO 引脚的 PIOC 设置
  • 代码行数变化:+1/-14

Pro 版本具体变更:

  • 从 UART0、UART1、UART2、UART3、UART5 的初始化代码中删除了所有 PAD_CTL 配置设置
  • 保留了 FUNC_CTL 的功能配置和对应的 PIOC GPIO 设置
  • 代码行数变化:+1/-24

代码简化效果

这次变更通过移除可配置的拉高和施密特触发器设置,使 UART 初始化函数的代码更加简洁。拉高配置现在可能通过其他方式(如默认硬件配置或 hpm_common.h 中的定义)来处理。

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2026

概览

该PR为两个板卡配置(lite和pro)的UART初始化添加了PAD_CTL(焊盘控制)设置。移除/替换了包含头文件,并在UART初始化函数中引入了rx_pad和tx_pad常量,配置各个UART实例的接收和发送焊盘的上拉与施密特触发器控制。

变更

UART焊盘控制配置

Layer / File(s) Summary
头文件更新
firmware/rmcs_board/boards/lite/app/board_app.cpp, firmware/rmcs_board/boards/pro/app/board_app.cpp
lite板移除hpm_common.h;pro板将hpm_common.h替换为hpm_clock_drv.h。
焊盘控制常量
firmware/rmcs_board/boards/lite/app/board_app.cpp, firmware/rmcs_board/boards/pro/app/board_app.cpp
在init_uart中引入rx_pad和tx_pad常量,配置上拉和施密特触发器参数。
PAD_CTL配置应用
firmware/rmcs_board/boards/lite/app/board_app.cpp (UART0/2/7), firmware/rmcs_board/boards/pro/app/board_app.cpp (UART0/1/2/3/5)
为各UART实例的RX/TX焊盘(以及UART1的DE引脚)分别应用PAD_CTL设置,配置相应的PIOC焊盘控制寄存器。

估计审查工作量

🎯 3 (Moderate) | ⏱️ ~20 分钟

可能相关的PR

  • Alliance-Algorithm/librmcs#33:两个PR都涉及多个UART实例的初始化和配置,该PR的焊盘控制变更与检索到的PR的多UART支持相一致。

诗意颂

🐰 焊盘控制新配置,
信号稳定更从容,
rx和tx齐步走,
施密特触发保护好,
UART通信更可靠!✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

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.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确地概括了主要变更:为UART引脚配置内部上拉电阻以防止浮空状态,这与两个文件中进行的PAD_CTL配置更改完全一致。
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 fix/uart-pullup

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.

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/boards/pro/app/board_app.cpp`:
- Around line 104-127: The DE pin for UART1 (PAD[IOC_PAD_PY05]) is missing a
PAD_CTL assignment: locate the UART1 block where
HPM_IOC->PAD[IOC_PAD_PY05].FUNC_CTL is set (and PIOC_PY05_FUNC_CTL_SOC_GPIO_Y_05
is assigned) and add a corresponding HPM_IOC->PAD[IOC_PAD_PY05].PAD_CTL =
de_pad; define de_pad similarly to tx_pad/rx_pad (e.g., include
IOC_PAD_PAD_CTL_PE_SET and IOC_PAD_PAD_CTL_PS_SET with pull-up or pull-down
chosen to match your RS485 transceiver disable level) so the DE line is biased
during init and won’t float.
🪄 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: d754c870-8372-4516-b4c8-700e5e6f2e6f

📥 Commits

Reviewing files that changed from the base of the PR and between ad5ecd5 and 5de6ad3.

📒 Files selected for processing (2)
  • firmware/rmcs_board/boards/lite/app/board_app.cpp
  • firmware/rmcs_board/boards/pro/app/board_app.cpp

Comment thread firmware/rmcs_board/boards/pro/app/board_app.cpp
@qzhhhi qzhhhi merged commit 4106fe6 into main May 6, 2026
5 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in RMCS Slave SDK May 6, 2026
@qzhhhi qzhhhi deleted the fix/uart-pullup branch May 6, 2026 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant