This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4VM: [TI RTOS]Task periodicity by Task_sleep() is not working as required.

Part Number: TDA4VM

Hello,

Created TI RTOS Task with adding delay of 5 ms. Below mentioning the code snippet. Board : J721E

/* Initialize the 5ms application and BSW task parameters*/
Task_Params_init(&taskParams_5ms);
taskParams_5ms.instance->name = FIVE_MS_TASK_NAME;
/* Set the task priority higher than the default priority (1) */
/*Set priority*/
taskParams_5ms.priority = 2;
taskParams_5ms.stack = ApplicationTask5ms_TaskStack;
taskParams_5ms.stackSize = sizeof (ApplicationTask5ms_TaskStack);

task = Task_create(ApplicationTask5ms_TaskFunction, &taskParams_5ms, &eb);
if(NULL == task)
{
BIOS_exit(0);
}

static Void ApplicationTask5ms_TaskFunction(UArg a0, UArg a1)
{
while(INFINITE)
{
Task_Periodicity((uint32)5000);
}
}

static void Task_Periodicity(uint32 usec)
{
uint32 timeout;

/* usec must be less than 1000000
if (usec >= 1000000) {
errno = EINVAL;
return (-1);
}*/

timeout = (uint32)((usec + Clock_tickPeriod - 1) / Clock_tickPeriod);

/* must add one tick to ensure a full duration of timeout ticks */
Task_sleep(timeout + 1);
}

But when we checked, the actual periodicity achieved is around 80 ms.

Could you please help me to resolve this problem?

Regards,

Chetan