Repository navigation
Conversation
Add RTC tickless STOP with LSI/LSE selection, clock snapshot restore, optional GPIO parking, and a CI attachconfig build. Document the timer_app power test (82 uA average, 18 uA STOP floor).
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
📌 Code Review Assignment🏷️ Tag: bsp_wchReviewers: @Maihuanyi Changed Files (Click to expand)
📊 Current Review Status (Last Updated: 2026-11-13 22:50 CST)
📝 Review Instructions
|
Rbb666
left a comment
There was a problem hiding this comment.
两处 PM 计时问题,详见行内评论。
Two PM timing issues are noted inline.
| { | ||
| SysTick->CTLR = 0; | ||
| SysTick->CMP = pm_state.runtime.tick_cmp; | ||
| SysTick->CNT = pm_state.runtime.resume_phase; |
There was a problem hiding this comment.
[P2] 补偿恢复阶段耗时 / Preserve elapsed recovery time
中文:STOP 唤醒后,resume_phase 在 tick 处理和设备恢复回调之前就已计算。这里用旧值覆盖 CNT,会丢弃这些操作的耗时,反复休眠使系统时间累计偏慢。请在最终恢复 SysTick 时计入新增周期,并补偿跨越的完整 tick。
English: After STOP, this assignment discards cycles spent processing ticks and resume callbacks after resume_phase was calculated. Include those elapsed cycles and any complete ticks when restoring SysTick.
| } | ||
|
|
||
| if (lsi_measuring && | ||
| now - lsi_measure_started >= rt_tick_from_millisecond(PM_LSI_TIMEOUT_MS)) |
There was a problem hiding this comment.
[P2] 避免低 tick 频率下校准提前超时 / Allow calibration at low tick rates
中文:配置为 10–20 Hz 时,初始化的 rt_thread_mdelay(1) 和这里的 50 ms 超时均为 1 tick。首次捕获被丢弃并重启后,立即命中超时,第二次采样无法完成,导致 PM 初始化失败。请让超时预算覆盖轮询粒度和两次捕获,或调整初始化采样方式。
English: At 10–20 Hz, both the polling delay and timeout become one tick. Discarding the first capture immediately triggers this timeout, preventing the second capture and failing PM initialization. Account for polling granularity and both captures.
|
晚上处理一下 |
|
Rbb666
left a comment
There was a problem hiding this comment.
复核当前 PM 实现,恢复阶段的时间补偿仍有重复计数问题,详见行内场景;建议修复后用持续唤醒测试与独立时基比较,覆盖跨 tick 的设备 resume 回调。另请处理当前失败的格式检查。提交历史含已合并的 fast-interrupt 前置提交、同步 merge 与本功能修正,最终合并前宜整理为一个可独立验证的 PM 提交。
| if (pm_state.runtime.systick_suspended) | ||
| { | ||
| SysTick->CTLR = 0; | ||
| total = pm_state.runtime.resume_phase + SysTick->CNT; |
There was a problem hiding this comment.
[P2] 仅补偿上次采样之后新增的恢复周期
pm_stop() 第 418–421 行已把 recovery_cycles = SysTick->CNT 计入 sleep_ticks/resume_phase,但计数器从第 407 行清零后一直继续运行。这里再加整个 CNT 会把那一段恢复时间计算两次。例如每 tick 为 1000 周期、RTC 部分正好对齐、首次采样 CNT=100、退出时 CNT=300,实际经过 300 周期,却恢复为 400 周期;重复 STOP 会使系统 tick 累计偏快。请保存已计入的计数器基线并仅补偿差值,或将首次恢复周期统一留到退出时结算,确保每个周期只统计一次。
There was a problem hiding this comment.
已修复:pm_stop() 不再提前计入 recovery_cycles,所有恢复周期统一在 rt_pm_exit_critical() 通过 resume_phase + SysTick->CNT 结算,避免重复计数,跨 tick 补偿仍保留。本地已通过 clang-format 22.1.8 检查和 devices.pm 配置的 CH32V208 BSP 编译。
拉取/合并请求描述:(PR description)
[
为什么提交这份PR (why to submit this PR)
为bsp ch32v208支持pm组件
依赖#12004
你的解决方案是什么 (what is your solution)
请提供验证的bsp和config (provide the config and bsp)
CH32V208
.config:
action:
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up