KW38 FreeRTOS task preemptive

cancel
Showing results for 
Search instead for 
Did you mean: 

KW38 FreeRTOS task preemptive

290 Views
Adam_Ho
Contributor II

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?

Adam_Ho_0-1662627551432.png

 

3 Replies

214 Views
nxf77486
NXP Employee
NXP Employee

 

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.

0 Kudos

256 Views
nxf77486
NXP Employee
NXP Employee

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.

freeRTOS Task Yield 

0 Kudos

250 Views
Adam_Ho
Contributor II

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:

Adam_Ho_0-1663056851688.png

The uart log looks like work well

Adam_Ho_1-1663056923596.png

2. In "frdmkw38_adv_ext_peripheral_freertos" I config configUSE_PREEMPTION == 1, and create same priority task like below:

Adam_Ho_2-1663057192753.png

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?

0 Kudos