Hi all,
I am confuse in FreeRTOS task,
According to my using experience task do not need yield if task will auto preemptive.
I saw taskYIELD() in sample project "freertos_mutex",
If I want task will auto preemptive without yield, how should I config?
Is it possible scheduler task like below?
Hello @Adam_Ho ,
In example frdmkw38_adv_ext_peripheral_freertos the configUSE_PREEMPTION for this example project is configured as 1 for default, it is necessary for the configuration to use the FreeRTOOSConfig.h to determine the preemption. Can you please share your task configuration.
Hello @Adam_Ho ,
Thank you for your time and contacting NXP support.
In this case if the preemption is active (in code configUSE_PREEMPTION value 1), in the example is 0 for default that is the reason why the task yield() is being used.
So if the configUSE_PREEMPTION is active (==1) a yield should not be performed just because a higher priority task has been woke.
Please let me know if you find this information useful, or if you have any other question I will be happy to assist you.
Also as additional please find on the official freeRTOS site some extra details regarding the yield task.
Hi @nxf77486 ,
Thanks for reply,
I have compared two project "frdmkw38_freertos_mutex" and "frdmkw38_adv_ext_peripheral_freertos".
1. In "frdmkw38_freertos_mutex" I config configUSE_PREEMPTION == 1, and create same priority task like below:
The uart log looks like work well
2. In "frdmkw38_adv_ext_peripheral_freertos" I config configUSE_PREEMPTION == 1, and create same priority task like below:
These two project I use the same method to create task but I got defferent result, where is the different?
It seems not useful to config "FreeRTOSConfig.h", isn't it?