hristozov wrote on Thursday, June 30, 2016:
Hi,
I am using STM32F4 with freeRTOSv8.0.1. IDE is coocox.
I have a task that blocks on a queue
xQueueReceive( QueueBtPkg, &bt_pkg_ptr, portMAX_DELAY);
and three higher priority tasks that puts data on the queue.
When one of this task puts something on the queue, the queue unlocks it task and everything is OK.
This works for between few minutes and a couple of hours, then the xQueueReceive stops unlocking it task and becomes full.
My first thought was that this is classic case of task starvation.
The task where the queue is never executes because the other three higher priority tasks always run.
In order to check this I created a dummy task
void task_debug(void * pvParameters) {
while (1) {
if (debug_message_cnt_EEG[debug_i_EEG] > 10) {
asm("nop");
}
}
}
and put break point on the asm(“nop”). This task has the lowest priority. It priority is lower then the task with the queue. In the if statement I check a value updated by the three sending tasks. This value is returned by uxQueueMessagesWaiting(QueueBtPkg).
debug_message_cnt_EEG[debug_i_EEG] = uxQueueMessagesWaiting(QueueBtPkg);
Now I see that the program stops at the break point at asm(“nop”). This means that the queue is not empty but doesn’t unlock the it task. Because the dummy task also has the lowest priority and it is unlocked there is no task starvation.
Anny ideas, what can cause this?