Skip to content
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

timer_api intermittent failures on Nordic nRF #23106

Closed
pabigot opened this issue Feb 26, 2020 · 4 comments
Closed

timer_api intermittent failures on Nordic nRF #23106

pabigot opened this issue Feb 26, 2020 · 4 comments
Assignees
Labels
area: Tests Issues related to a particular existing or missing test area: Timer Timer bug The issue is a bug, or the PR is fixing a bug platform: nRF Nordic nRFx priority: low Low impact/importance bug

Comments

@pabigot
Copy link
Collaborator

pabigot commented Feb 26, 2020

The same failure identified in #21813 and #22623 can occur on Nordic hardware:

starting test - test_timer_duration_period

Assertion failed at ZEPHYR_BASE/tests/kernel/timer/timer_api/src/main.c:64: duration_expire: interval >= 100 is false

Analysis suggests this is a false failure: the test measures durations in milliseconds, while the Nordic clock tracks 32 KiHz (32768 Hz) ticks that don't align to millisecond boundaries. Since information is lost every time a 32 KiHz count is truncated to a 1000 Hz count it's possible that the difference in time measured in 32 KiHz counts is greater than 100 ms while the difference in 1000 Hz counts is less than 100 ms. To avoid the information loss the timestamps need to be measured in hardware ticks with millisecond durations calculated directly from the difference in hardware ticks.

@pabigot pabigot added bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug labels Feb 26, 2020
@pabigot
Copy link
Collaborator Author

pabigot commented Feb 26, 2020

@ioannisg @carlescufi

@carlescufi carlescufi changed the title timer_api intermittent failures on Nordic timer_api intermittent failures on Nordic nRF Feb 28, 2020
@pabigot
Copy link
Collaborator Author

pabigot commented Apr 4, 2020

This failure is usually particularly repeatable on the board formerly known as nrf51_pca10028. which also has:


starting test - test_timer_remaining

    Assertion failed at ../src/main.c:547: test_timer_remaining: rem_ticks <= dur_ticks / 2 is false

FAIL - test_timer_remaining
===================================================================
starting test - test_timeout_abs

    Assertion failed at ../src/main.c:570: test_timeout_abs: t2.ticks == t.ticks is false

@carlescufi carlescufi added the area: Tests Issues related to a particular existing or missing test label Apr 30, 2020
@pabigot pabigot assigned pabigot and unassigned andyross May 25, 2020
@pabigot
Copy link
Collaborator Author

pabigot commented May 25, 2020

This is mostly fixed by #24080. There's one additional test case where relaxation is required using INEXACT_MS_CONVERT. I'm also checking the clock error on the board I can reproduce this with.

@pabigot
Copy link
Collaborator Author

pabigot commented May 25, 2020

The board I can reproduce this on has a 16000 ppm error in the 16M RCOSC, which is 1.5% and within the +/-5% allowed error, but is too large for the currently coded configurations. It doesn't seem worth relaxing the test tolerance again for this.

@pabigot pabigot closed this as completed May 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Tests Issues related to a particular existing or missing test area: Timer Timer bug The issue is a bug, or the PR is fixing a bug platform: nRF Nordic nRFx priority: low Low impact/importance bug
Projects
None yet
Development

No branches or pull requests

4 participants