I am using FreeRTOS version 7.5.2 since about 2 years without any problem on PIC24F, until I decided for some technical reasons to change task priority, if all my task has same priority NO problem, if the task ( or any task) has lowest priority than the others , this task never start, if you can give some way to search or debug in my complex source file, it will be fine.
here my a part of my main source code :
xTaskCreate( vTaskCOM1Process,( signed char * )“C1P”, configMINIMAL_STACK_SIZE*2,NULL, 3,NULL);
xTaskCreate( vTaskCOM2Process,( signed char * )“C2P”, configMINIMAL_STACK_SIZE,NULL, 3,NULL);
xTaskCreate( vTaskStartP24,( signed char * )“CCP”, configMINIMAL_STACK_SIZE,NULL, 5,NULL);
xTaskCreate( vTaskPOOLAnalog,( signed char * )“CANA”, configMINIMAL_STACK_SIZE*2,NULL,2,NULL);
If a higher priority task never blocks (calls a delay function, or waits for queue data or semaphore etc) then lower priority tasks will be ‘starved’, meaning they wont ever be scheduled.
Yes. This code is using 0 as the block time so is not waiting for the semaphore. It will just spin round the loop very quickly, not letting lower priority tasks run. The taskYIELD() will let tasks that have the same priority run, but that is all. If you use a block time in your call to xSemaphoreTake() it should fix your problem.
The basic problem is that Yield doesn’t block, it only lets other tasks of the same priority run before you.
Since all you are doing on the Semaphore take is yielding, you might as well put in a block time and let the task just block until the semaphore is given.
The block time could be set to the max, or if you want to have some error recovery, make it longer than you every should need to wait, and then you have the option of seeing if you see signs of problems before retrying.