Software stuck at portTASK_FUNCTION

Hi, I am new to freeRTOS and I am using it with a STM32L476 board (Nucleo-64).
I have created a task and started the scheduler. myTask1 has an infinite while loop.

xTaskCreate(myTask1, “task1”, 200, (void*)0, tskIDLE_PRIORITY, &myTaskHandle);

If I run the software it gets stuck inside vTaskStartScheduler(). To be precise it is inside portTASK_FUNCTION. Can you please help me.

PortTASK_FUNCTION is a macro, not a function. It is used to declare tasks, like the Idle task. Could the issue be you task wasn’t successfully created so Al that is running is the Idle task?

Task is successfully created. I just checked the return value of xTaskCreate. It is pdPASS.

If I look in the debugger window, it shows prvIdleTask() in the left window. It is stuck here.

Since you’re using tskIDLE_PRIORITY for your task you should set
#define configIDLE_SHOULD_YIELD 1
in your FreeRTOSConfig.h to give your task a chance to run besides the idle task.
Alternatively bump the prio of your task e.g. to tskIDLE_PRIORITY +1.

Thanks for the solution. It has helped.