Skip to content

[boards] Fix off-by-one in SysTick cyclesPerTick#40

Open
SAY-5 wants to merge 1 commit into
wolfSSL:mainfrom
SAY-5:fix-systick-reload-off-by-one
Open

[boards] Fix off-by-one in SysTick cyclesPerTick#40
SAY-5 wants to merge 1 commit into
wolfSSL:mainfrom
SAY-5:fix-systick-reload-off-by-one

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented May 12, 2026

Fixes #38.

Cortex-M SysTick reloads every LOAD + 1 cycles, so cyclesPerTick must be clock / ticks_per_second - 1 to produce the intended period. All ten board configs were one cycle high, causing the 1 kHz tick to run slightly slow.

Applied the maintainer-suggested fix (subtract 1 in each board config) rather than baking the offset into systick.c, to preserve the "cyclesPerTick" naming and keep RVR writes literal.

Cortex-M SysTick reloads every (LOAD + 1) cycles, so cyclesPerTick must
be (clock / ticks_per_second) - 1 to produce the intended period. All
ten board configs were one cycle high, causing systick to run slightly
slow.

Closes wolfSSL#38
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.

Systick reload value off by one

1 participant