Monday, February 19th 2018, 8:46pm UTC+1

You are not logged in.

  • Login
  • Register

Date of registration: Jan 18th 2018

Posts: 2

1

Thursday, January 18th 2018, 3:47pm

OS_Delay(1) not accurate

Hi,

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.


Thanks,
Lior

SEGGER - Martin

Super Moderator

Date of registration: Jul 1st 2014

Posts: 34

2

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():

Quoted

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,
Martin

Date of registration: Jan 18th 2018

Posts: 2

3

Thursday, January 18th 2018, 4:27pm

Yes, this answers my question, thanks :)