Kernel crashed when calling vTaskDelay() before starting scheduler


I’m facing a crash issue when my program unintendedly calls vTaskDelay() before the application starts the scheduler (calling vTaskStartScheduler). Is it an expected behavior?
I attach my call stack so that people can get deeper inside the code.

Chi Tran

Yes, that is expected behaviour. There are no tasks running before the scheduler starts, so vTaskDelay() cannot switch to anything, and the kernel data structures might not even be initialised. Checking if the scheduler is running in each API call would carry too much code size and run time penalty when the scheduler actually is running.

1 Like

It makes sense to me. Thank you so much.