Task scheduling
Answer
11/18/15 11:04 AM
Hey,

I am currently trying to use the XDK for a real-time application. Therefore I wanted to use priority scheduling by using the OS_operatingSystem library. Until some days ago this worked out fine for me. I was using three tasks that provide three independed time bases: 1x10ms time base for control algorithms and 2x100ms for printig debug information and a simple clock. As it seems, the XDK provides 5 different priority levels ranging from 0 (highest) to 4 (lowest). Independent from the workload in the debug time base (priority 3), the 10ms time base (priority 1) gets executed 100x per second.
To estimate the overall workload of the CPU i tryed to implement an idle task with the priority 4. This task does nothing but incrementing a variable that is printed and reset periodically in the debug task. When I try to execute this program the XDK doesn't do anything anymore, it even isn't able to connect via usb anymore. With a priority of 3 for the idle task, the XDK connects again but doesn't print any data. With a priority of 2, data is printed but the 10ms timebase doesn't get executed. I need a priority of at least 1 or 0 to be able to execute all tasks properly again.
When I try to interpret this behaviour it seems like the priority of the idle task is in inverted order related to the others where 0 is the lowest priority and 4 the highest.
Can anybody explain this behaviour to me?
Thank you very much in advance!

Kind regards,

Kai Liebich

Idle Task:
OS_taskHandle_tp taskHandleIdle;

void init_cpu_load(void)
{
    OS_taskCreate((OS_taskCode_tp)cpu_idle, (int8_t*)"CPU_Idle", STACK_SIZE, PRIORITY_IDLE, &taskHandleIdle);
}

void cpu_idle(void)
{
    for(;;)
    {
        status.cpu_load++;
    }
}

Template for the other tasks:
OS_taskHandle_tp taskHandleTB10;

void TB10_Task(void)
{
    portTickType prevWakeTime;
    const portTickType timeIncrement = (portTickType)(10); //10ms

    prevWakeTime = xTaskGetTickCount();

    for(;;)
    {
        /*
        executed Code
        */
        OS_taskDelayUntil(&prevWakeTime, timeIncrement); //Delay Task for about 10ms to run periodically
    }
}

void TB10_Init(void)
{
    OS_taskCreate((OS_taskCode_tp)TB10_Task, (int8_t*)"TB10", STACK_SIZE, PRIORITY_TB10, &taskHandleTB10);
}

P.S.: I already tried to print the return value of the OS_xyz... functions but they either all returned OS_ERR_NO_ERROR or printig to the console didn't work at all as mentioned above.
0 (0 Votes)
Task scheduling
Answer
11/19/15 10:35 AM as a reply to Kai Clemens Liebich.
If this information is also helpful: with a priority of 4 for the idle task none of the four LEDs is active.
0 (0 Votes)
Task scheduling
Answer
11/25/15 9:21 AM as a reply to Kai Clemens Liebich.
Hello,

anyone has any idea what the problems is?
Thank you!

Best regards

Kai
0 (0 Votes)
Task scheduling
Answer
11/27/15 12:21 PM as a reply to Kai Clemens Liebich.
Kai,

I tested your code and ran into the same issues.

I opened a ticket with our second level support for this and I'm planning to discuss it later today with them.

Once I have further information, I'll respond here.

- Florian
0 (0 Votes)