-
Notifications
You must be signed in to change notification settings - Fork 895
Description
Describe the bug
tx_thread_sleep is not accurate when I set below system_clock and systick_cycles.
SYSTEM_CLOCK = 491520000
SYSTICK_CYCLES = ((SYSTEM_CLOCK / 1000000) -1)
When I call tx_thread_sleep(10) I'm expecting my system to wake up 10 systick later.
I added tx_time_get() before and after sleep and check the tick, it varies from 16to 33.
Is this expected behavior?
If it is, how can we have exact us(microsecond)-based sleep time?
Please also mention any information which could help others to understand
the problem you're facing:
- What target device are you using? cortex-m3
- Which version of Azure RTOS? 6.1.12
- What toolchain and environment? arm-none-eabi-gcc (GNU Arm Embedded Toolchain 10.3-2021.10) 10.3.1 20210824 (release)
- What have you tried to diagnose or workaround this issue?
To Reproduce
Steps to reproduce the behavior:
- Build my project in IAR Workbench.
Set below values in tx_initialize_low_level.S
SYSTEM_CLOCK = 491520000
SYSTICK_CYCLES = ((SYSTEM_CLOCK / 1000000) -1) - See error
ULONG old, new;
old = tx_time_get();
tx_thread_sleep(10);
new = tx_time_get();
printf("sleep time: %ld\n", new - old);
Expected behavior
I'm expecting print value around 10 but it is vary between 16 to 33.
Impact
What impact does this issue have on your progress (e.g., annoyance, showstopper)
Can not use this RTOS.
Logs and console output
If applicable, add console logs or other types of debug information like Wireshark capture as .zip file.
Additional context
Add any other context about the problem here.