Tuesday, April 24th 2018, 12:17pm UTC+2

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Date of registration: Jan 18th 2018

Posts: 3


Thursday, January 18th 2018, 3:47pm

[SOLVED] OS_Delay(1) not accurate


I am experiencing wrong delay times when using OS_Delay.
I ask for 1[ms] delay ( OS_Delay(1); ) but the actual delay I receive varies anywhere between 830-950 [us].
Is this normal behavior for embOS or am I missing something?

1. Which embOS do you use?
I use embOS trial for Cortex-M and IAR compiler version 4.40 with IAR workbench 8.20.1 (embOS_CortexM_IAR_V8_Trial_V440).

2. Which CPU and eval board do you use?
I use Silicon Labs EFR32FG13P231F512GM48 cpu.

3. Which start project do you use?
I downloaded a trial package and used a start project from it (Silicon Labs EFM32_G2XX_DK) and configured it to match my CPU.


SEGGER - Martin

Super Moderator

Date of registration: Jul 1st 2014

Posts: 35


Thursday, January 18th 2018, 4:10pm

Hi Lior,

Thanks for your inquiry. However, this is not an issue, but instead is working as intended. Please refer to the embOS manual on OS_Delay():


The actual delay (in basic time intervals) will be in the following range: t - 1 ≤ delay ≤ t , depending on when the interrupt for the scheduler occurs.

To elaborate on this, please imagine the following, examplary scenario:
- The SysTick is configured to occur at every 1000 timer cycles.
- At the moment OS_Delay(1) is called by the application, the timer counter already holds 500 cycles.
So in this situation, 500 cycles have already expired, while another 500 cylces remain before the next occurance of the timer interrupt. Then, OS_Delay(1) will delay the task for 500 timer cycles.
If, on the other hand, the timer counter holds 200 cycles when OS_Delay(1) is called, then 800 cycles have already expired, and mere 200 cycles remain until the next occurance of the timer interrupt. Then, OS_Delay(1) will delay the task for 200 timer cycles.

Does this answer your question? Please let me know if I can be of any further help.

Best regards,

Date of registration: Jan 18th 2018

Posts: 3


Thursday, January 18th 2018, 4:27pm

Yes, this answers my question, thanks :)