atmel-samd: turn off timer clocks after both timers sharing a GCLK channel are free
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 56/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- c
- 领域
- embedded-iot
调研方向
Start with timer_handler.c and inspect tc_gclk_ids[], tcc_gclk_ids[], and the timer allocation and release paths. Read the linked issue #11776 for why disabling a shared GCLK channel caused hangs. Track whether each timer pair is in use, then test the leak and partner-timer scenarios described here; done means reload no longer hangs and a partner PWMOut keeps running.
由索引模型根据 Issue 内容生成。
描述
Drafted by Claude, reviewed by @dhalbert.
Background
@tannewt's atmel-samd finalizer-cleanup commit added turn_off_clocks() in timer_handler.c. PWMOut, PulseIn, PulseOut, AudioOut, RGBMatrix and PewPew called it when they released a timer. It disabled the timer's GCLK peripheral channel and its APB clock.
However, #11776 removes it, because timers share GCLK peripheral channels in pairs, and it caused a hang. Releasing one timer stopped its partner's clock:
- A
PWMOuton the partner timer stopped running. - Deinitializing the partner then waited forever for its software reset to sync. Boards hung at the end of the VM, with USB gone.
| Timers sharing a channel | |
|---|---|
| SAMD21 | TCC0/TCC1, TCC2/TC3, TC4/TC5, TC6/TC7 |
| SAMD51 | TC0/TC1, TCC0/TCC1, TC2/TC3, TCC2/TCC3, TC4/TC5, TC6/TC7 (TCC4 has its own) |
Proposal
Bring back turn_off_clocks(), but disable a shared GCLK peripheral channel only when neither timer in its pair is in use. The APB clock is per timer, so it can still be turned off on its own.
This needs a record of which timers are in use, for example a bitmask set when a timer is allocated and cleared in turn_off_clocks(). Each timer's peripheral channel ID from tc_gclk_ids[] and tcc_gclk_ids[] finds its partner.
How to test
- Leak one of each pin-owning object, including
PWMOutandPulseOuton both timers of a pair, then reload. The board shouldn't hang. - A
PWMOutkeeps running after an object on its partner timer is deinited.
- 主要语言
- C
- 星标
- 4.6k
- 派生
- 1.4k
- 平均合并
- 1 天 3 小时
- 30 天内合并 PR
- 186
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
adafruit/circuitpython 的其他 Issue
-
documentation rp2
难度 1/5 1-3 小时 新手友好度 67/100
adafruit/circuitpython#11779 ·
维护者通常 1 天内回复
-
documentation enhancement
难度 2/5 1-3 小时 新手友好度 67/100
adafruit/circuitpython#11689 ·
维护者通常 1 天内回复
-
bug espressif
难度 4/5 3-5 天 新手友好度 48/100
adafruit/circuitpython#11763 ·
维护者通常 1 天内回复
-
Feather RP2350: MAX3421E instead of PIO USB host, or a second build?可能已有人在做 @mikeysklar 于 8 天前认领。 未关闭rp2 usb
adafruit/circuitpython#11697 · 5 条评论 · 已指派 2 人 ·
维护者通常 1 天内回复
-
rp2040 zephyr
难度 5/5 一周以上 新手友好度 35/100
adafruit/circuitpython#11690 ·
维护者通常 1 天内回复
查看 adafruit/circuitpython 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 80/100
ly05010419/MacNativeGames#1897 ·
维护者通常 1 天内回复
-
area: metrics area: tracing contribfest enhancement good first issue
难度 2/5 1-3 小时 新手友好度 83/100
open-telemetry/opentelemetry-ebpf-instrumentation#4188 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
FujiNetWIFI/fujinet-firmware#2328 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
ycrash/yc-360-script#44 ·