…is not going to work because vTaskDelay() will not return if interrupts are disabled. If it does return, then your interrupt priorities or configuration are incorrect.
is incorrect but fortunately useless since it seems you’re using the FreeRTOS default SysTick implementation which configures it to the LOWEST interrupt priority.
This ensures no/minimal impact of the OS internals to the application.
Thanks rtel for looking into the issue.
I checked in detail and I came to know that, API: vTaskDelay will set timeout for that particular task and also set the “xNextTaskUnblockTime” in OS variable.
When we come out from the critical section, Tick interrupt hit and system go for tick increment where it schedule the idle task and after 1500ms, It start execution of next lines of “BswTask0” task.
I haven’t seen any line in “vTaskDelay”, Where it will wait until the timeout.
Exactly Hartmut Schaefer. It should be lowest. Thanks for highlighting this.
I cross verified in system register and found that, This line is useless because default priority is zero and its been override from RTOS.
When you call vTaskDelay(1500), your task is placed on the delayed task list and then a yield is performed. At that point your task will not be scheduled again until the delay time is over. The yield is here. The yield occurs insidevTaskDelay(). Your task “waits” inside vTaskDelay() to be scheduled again, and vTaskDelay() won’t return until the delay ends.
As Richard said, you must not call vTaskDelay() from inside a critical section. The tick ISR cannot execute inside a critical section, meaning that time stands still inside a critical section. Your delay would never end.
Thanks everyone, Finally I found the root cause.
After detailed analysis, We came to know that, Problem was in boot loader and system got stuck in application startup.
This is the deinitialization sequence in boot loader which we are performing before jumping on to the application.
What was happening that, Disable interrupt had done its job and before we DE initialize system tick, Tick interrupt was generated in back end which was creating issue while enabling the global interrupt in startup sequence of application where it jump on SysTick_Handler and OS is not yet initialize.
Thanks again everyone for looking into this matter.