Skip to content

Improves micros() accuracy using SysTick COUNTFLAG #202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 18, 2018

Conversation

fpistm
Copy link
Member

@fpistm fpistm commented Jan 17, 2018

Test:

  for( uint32_t i = 0; i<2000; i++) { 
    start_us= micros();
    delayMicroseconds(i);
    end_us = micros();
  }

diff = end_us - start_us is the difference btw the requested delay and the measured one with micros()
old = number of the same difference in the 2000 iteration for the previous implementation
new = number of the same difference in the 2000 iteration for this PR implementation

Nucleo-F103RB

diff (µs) old new
0 0 4
1 0 149
2 633 1842
3 1015 5
4 348 0
5 3 0

Discovery L475VG IOT

diff (µs) old new
0 148 699
1 811 1030
2 1038 271
3 3 0
4 0 0
5 0 0

@fpistm fpistm added the enhancement New feature or request label Jan 17, 2018
@fpistm fpistm self-assigned this Jan 17, 2018
@fpistm fpistm merged commit 8f0a0e2 into stm32duino:master Jan 18, 2018
@fpistm fpistm deleted the micros branch January 18, 2018 22:01
benwaffle pushed a commit to benwaffle/Arduino_Core_STM32 that referenced this pull request Apr 10, 2019
Improves micros() accuracy using SysTick COUNTFLAG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant