FreeRTOS scheduler not triggers the task on time

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

FreeRTOS scheduler not triggers the task on time

1,246 次查看
samcs
Contributor II

Ported old project on For Arm 2.0  platform to S32DS 3.4 Platform, but found the scheduler not triggers the task on time.


xTaskCreate( InitJobTask, "IK", 512 , NULL, mainQUEUE_SEND_TASK_PRIORITY + 8, &Rt_InitTaskxHandle); // Init Task
xTaskCreate( DrvTask, "TH", 512 , NULL, mainQUEUE_SEND_TASK_PRIORITY + 11, &Rt_DrvTaskxHandle );

vTaskStartScheduler();

 

static void InitJobTask( void *pvParameters )
{

     for( ;; )
    {
        SystemInit();
      vTaskSuspend(Rt_InitTaskxHandle);
    }
}

 

uint32_t drvt1 = 0;
uint32_t drvt2 = 0;
uint32_t drvDelt[32] = {0};
static void DrvTask( void *pvParameters )
{
    static TickType_t xLastWakeTimeMs;
    int i = 0;

    xLastWakeTimeMs = xTaskGetTickCount();

    for( ;; )
    {
         drvt2 = GetTimeStampTimeMs(); 

         DrvTask();

         drvDelt[i] = drvt2 - drvt1; 
         drvt1 = drvt2;

        i += 1;
       if (i >= 32 )
      {
          i = 0;
       }

      vTaskDelayUntil( &xLastWakeTimeMs, 5);

   }

}

Debug result:

samcs_0-1653182491720.png

but the old project on For Arm 2.0, works well.

Did anyone meet similar issue before?  i don't know how to fix it now.

 

 

 

 

0 项奖励
回复
5 回复数

1,168 次查看
samcs
Contributor II

Found the issue

0 项奖励
回复

1,221 次查看
samcs
Contributor II

I found in task.c , NXP SDK, /SDK/rtos/FreeRTOS/Source/tasks.c,
the macro defined in FreeRTOSConfig.h , seems not working,
for example,

samcs_0-1653251278155.png


While in FreeRTOSConfig.h:

samcs_1-1653251312980.png

Even i added the macro definition  in task.c:

samcs_2-1653251361022.png

still the macro not works, why macro be defined, but it not works?

0 项奖励
回复

1,207 次查看
jiri_kral
NXP Employee
NXP Employee

Hi, 

I'm not sure if I get the point - you like to disable the RUN_TIME_STATS? Or you like to enable it? If you like to enable it - you need to set configGENERATE_RUN_TIME_STATS to 1 - like this: 

 

#define configGENERATE_RUN_TIME_STATS   1

 

Jiri

0 项奖励
回复

1,203 次查看
samcs
Contributor II

it should be disabled, in fact, in task.c, all macros not working,need to check makefile, i think,

it's weird, even i define a new Macro in the file, 

#define Configure_AAAAAA   0

#if (Configure_AAAAAA != 0)

still, it not works

0 项奖励
回复

1,191 次查看
jiri_kral
NXP Employee
NXP Employee

Hi, 

just for clarification (i'm little bit lost) - what behavior are you expecting from your code snippet

 

#define Configure_AAAAAA   0

#if (Configure_AAAAAA != 0)

        do_something();

#endif

 

?

0 项奖励
回复