xTaskCreatePinnedToCore() function
Create a new task that is pinned to a particular core This function is similar to xTaskCreate(), but allows the creation of a pinned task. The task's pinned core is specified by the xCoreID argument. If xCoreID is set to tskNO_AFFINITY, then the task is unpinned and can run on any core.
Arguments
xCoreID
The core to which the task is pinned to, or tskNO_AFFINITY if the task has no core affinity.
pxTaskCode
Pointer to the task entry function.
pcName
A descriptive name for the task.
pvParameters
Pointer that will be used as the parameter for the task being created.
uxPriority
The priority at which the task should run.
Return value
pdPASS if the task was successfully created and added to a ready list, otherwise an error code defined in the file projdefs.h
Notes
If ( configNUMBER_OF_CORES == 1 ), setting xCoreID to tskNO_AFFINITY will be be treated as 0.
xTaskCreatePinnedToCore() is called by 3 functions and calls 5 functions:
![]()
xTaskCreatePinnedToCore()
xTaskCreatePinnedToCore() writes 2 variables:
![]()
xTaskCreatePinnedToCore()
xTaskCreatePinnedToCore() frees 1 types:
![]()
xTaskCreatePinnedToCore()