eriksage wrote on Wednesday, August 08, 2012:
Dear support forum,
I have a problem regarding tha task priority, interrupt priority and the use of semaphores.
At initialization, a startupThread is created and the scheduler is started.
If the task priority of the startupThread is lower than 9, the code is working. If it is higher than 9, the code only works if I put a breakpoint in the xPortPendSVHandler and steps through the code.
The problem occurs when the startupThread is waiting for a semaphore that is released in an I2C interrupt. When the semaphore is released, the StartupThread does not continue to run. Neither because of a semaphore timeout or because of the release. I can see that the semaphore is released and that portEND_SWITCHING_ISR ( xHigherPriorityTaskWoken ) is called with xHigherPriorityTaskWoken == 1. However the startupThread is never continued. Since the semaphore also have a timeout I find this very strange.
I suspect that there might be an issue regarding the setup of the interrupt priorities or task priorities. Any ideas? Can the increased size of the taskList cause more delay and trigger a problem with a race-condition?
Is there a limit for the task priority other than configMAX_PRIORITIES?
Info:
FreeRTOS V7.0.1
MCU: Freescale Kinetis K10.
Compiler: IAR 6.21
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 12 )
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0xf
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
Best regards,
Erik Agerup