There is no problem with using the function in this way. If there is a problem with the call at the higher nesting depth then the most likely problem would be a stack shortage - as the function depth will be using more stack before the call toe vTaskDelay. Try increasing the stack allocated to the task when the task is created.