Hi,
I have three tasks running periodically. All of them are triggered by PRD module PRD0 with period of 100ms. The PRD0 is set to be triggered by the default PRD_CLOCK. All of there three tasks have the same form as following (X as number):
All semaphores have intial value of 0, to prevent any task runs before PRD function allowed to.
void task_X(){
while(1){
sem_pend(semX);
//do some calculation
printf("debug message");
TSK_yield();
}
}
The PRD function simply post the semaphores:
PRD_function(){
sem_post(sem1);
sem_post(sem2);
sem_post(sem3);
}
When I set these three tasks with same priority, say 13, they all ran out of control, for example, task1 would keep running and task2,3 are blocking all the time, the value of the semaphores all increased uncontrollable. And task1 was even not doing the correct computation (as I can see from the printf debug message).
However, when I reconfigure those tasks with different priority, say task1 with priority 13, task2 with 12, task3 with 11, they ran happily without errors.
Can someone suggest a solution to this problem?
Many thanks.
Best Regards,
Steven