arduino / arduino/ArduinoCore-sam

delay() is inaccurate, averaging 500us too short.

Open
#60 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
91
Forks
112
PR merge metrics
No merged PRs in 30d

Description

Since delay(n) waits for n ticks of the millisecond counter, any time already elapsed in the "current" millisecond isn't taken into account.

This was fixed a long time ago for the AVR, but it didn't make it into SAMD/SAM

https://github.com/arduino/Arduino/issues/237

https://github.com/arduino/ArduinoCore-avr/commit/67c0a1995aace2953e481ef6183b1b91e04942fc#diff-ab397febf179e1982f4ee0758df4c982

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the SAM/SAMD implementation of delay(n) and compare its millisecond-counter behavior with the linked AVR issue and commit. Done means elapsed time in the current millisecond is accounted for so delay(n) no longer averages about 500us too short.

Written by the indexing model from the issue text.

Assessment

Domain
embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.