Skip to content

SAM TC: Implement capture mode, configurable counter width#200

Open
msarehn wants to merge 2 commits intorenode:masterfrom
MenloSystems:upstream/sam4e-tc-fixes
Open

SAM TC: Implement capture mode, configurable counter width#200
msarehn wants to merge 2 commits intorenode:masterfrom
MenloSystems:upstream/sam4e-tc-fixes

Conversation

@msarehn
Copy link
Copy Markdown

@msarehn msarehn commented Apr 24, 2026

Capture mode

In capture mode (WAVE=0), the timer now runs as a free-running
counter with overflow interrupts, matching real hardware behavior.
Previously, capture mode logged "Unimplemented" and left the timer
unconfigured. Also enables RC compare (cTimer) in capture mode.

Counter width

The SAM4E has 32-bit TC counters while the SAM4S has 16-bit.
Add a counterWidth constructor parameter (default 16) to support
both variants. With 16-bit counters, firmware using 32-bit overflow
counting saw wildly incorrect time values.

msarehn and others added 2 commits April 24, 2026 15:21
In capture mode (WAVE=0), the timer now runs as a free-running
counter with overflow interrupts, matching real hardware behavior.
Previously, capture mode logged "Unimplemented" and left the timer
unconfigured. Also enables RC compare (cTimer) in capture mode.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The SAM4E has 32-bit TC counters while the SAM4S has 16-bit.
Add a counterWidth constructor parameter (default 16) to support
both variants. With 16-bit counters, firmware using 32-bit overflow
counting saw wildly incorrect time values.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@msarehn msarehn force-pushed the upstream/sam4e-tc-fixes branch from 6809274 to 31f0c51 Compare April 24, 2026 13:21
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