vTaskDelayUntil suspend all the tasks

Why does it suspend all tasks and then resume them? Isn’t it possible wait a fixed period without suspend the tasks? I created 2 tasks that switch onoff leds. Each task has its own leds. In one task I repalce the vTaskDelayUntil with for cycles simulated a waiting period. To be sure under the for (always) { } I added a CRITICAL REGION. -———————- static portTASK_FUNCTION( vLEDFlashTask1, pvParameters ) { portTickType xFlashRate, xLastFlashTime; unsigned portBASE_TYPE uxLED; int i; int max; max=0x7FFFFFF;     /* The parameters are not used. */     ( void ) pvParameters;         uxLED=1;             xFlashRate = ledFLASH_RATE_BASE + ( ledFLASH_RATE_BASE * ( portTickType ) uxLED );     xFlashRate /= portTICK_RATE_MS;     /* We will turn the LED on and off again in the delay period, so each     delay is only half the total period. */     xFlashRate /= ( portTickType ) 1 ;     /* We need to initialise xLastFlashTime prior to the first call to     vTaskDelayUntil(). */     xLastFlashTime = xTaskGetTickCount();     for(;;)     {           taskENTER_CRITICAL();           {         /* Delay for half the flash period then turn the LED on. */         vTaskDelayUntil( &xLastFlashTime, xFlashRate );             for (i=0;i<max;i++){                   i=i;             }         vParTestToggleLED( uxLED-1 );         /* Delay for half the flash period then turn the LED off. */ //        vTaskDelayUntil( &xLastFlashTime, xFlashRate );             for (i=0;i<max;i++){                   i=i;             }         vParTestToggleLED( uxLED-1 );                               /* Delay for half the flash period then turn the LED on. */ //        vTaskDelayUntil( &xLastFlashTime, xFlashRate );             for (i=0;i<max;i++){                   i=i;             }         vParTestToggleLED( uxLED );         /* Delay for half the flash period then turn the LED off. */ //        vTaskDelayUntil( &xLastFlashTime, xFlashRate );             for (i=0;i<max;i++){                   i=i;             }         vParTestToggleLED( uxLED );           }           taskEXIT_CRITICAL();         } } -———————– When I run, leds of this task are always lighting fast. It not waits as the for always cycle says. Why?

vTaskDelayUntil suspend all the tasks

I’m not sure why you have the critical sections, but if you have both tasks structured like this then you are going to spend nearly all the time with interrupts disabled, which is probably your problem. Take a look at FreeRTOSDemoCommonMinimalflash.c which contains simple LED flash tasks using vTaskDelayUntil(). Regards.