Ошибка программного таймера FreeRTOS (taskSCHEDULER_RUNNING) - PullRequest
0 голосов
/ 27 августа 2018

Оборудование: NXP M4 MKE14

Программное обеспечение: MCUXpresso 10.1.1

Реализация одного программного таймера проходит очень хорошо. При запуске второго таймера микроконтроллер больше не отвечает. Я получаю сообщение об ошибке «taskSCHEDULER_RUNNING». Но если это не работает, система ничего не делает.

Я реализовал таймеры и одну задачу следующим образом:

   /* Create the queue used by the queue send and queue receive tasks. */
        xQueue = xQueueCreate(/* The number of items the queue can hold. */
                              mainQUEUE_LENGTH,
                              /* The size of each item the queue holds. */
                              sizeof(uint32_t));

xSensorTimer = xTimerCreate(/* A text name, purely to help
                                   debugging. */
                                     "SensorTimer",
                                     /* The timer period, in this case
                                     1000ms (1s). */
                                     SENSOR_TIMER_PERIOD_MS,
                                     /* This is a periodic timer, so
                                     xAutoReload is set to pdTRUE. */
                                     pdTRUE,
                                     /* The ID is not used, so can be set
                                     to anything. */
                                     (void *)0,
                                     /* The callback function */
                                     vTimerCallback_SensorTimer);
                                if(xSensorTimer==NULL) {
                                    for(;;); /*failure! */
                                }

xSUS_BUS_TIMEOUT_Timer = xTimerCreate(/* A text name, purely to help
                                   debugging. */
                                     "SUS_BUS_TIMEOUT_Timer",
                                     /* The timer period, in this case
                                     1000ms (1s). */
                                     SUS_BUS_TIMEOUT_PERIOD_MS,
                                     /* This is a periodic timer, so
                                     xAutoReload is set to pdTRUE. */
                                     pdFALSE,
                                     /* The ID is not used, so can be set
                                     to anything. */
                                     (void *)1,
                                     /* The callback function */
                                     vTimerCallback_SUSBUSTIMEOUT);
                                if(xSUS_BUS_TIMEOUT_Timer==NULL) {
                                    for(;;); /*failure! */
                                }

    xTaskCreate(/* The function that implements the task. */
                prvQueueModuleTask,
                /* Text name for the task, just to help debugging. */
                "Module",
                /* The size (in words) of the stack that should be created
                for the task. */
                configMINIMAL_STACK_SIZE + 166,
                /* A parameter that can be passed into the task.  Not used
                in this simple demo. */
                NULL,
                /* The priority to assign to the task.  tskIDLE_PRIORITY
                (which is 0) is the lowest priority.  configMAX_PRIORITIES - 1
                is the highest priority. */
                mainQUEUE_MODULE_TASK_PRIORITY,
                /* Used to obtain a handle to the created task.  Not used in
                this simple demo, so set to NULL. */
                NULL);

    /* Start the tasks and timers running. */
    vTaskStartScheduler();

    /* The program should never enter this while loop */
    while(1)
    {
        ;
    }
}

static void vTimerCallback_SensorTimer (xTimerHandle pxTimer)
{
    ReadTemperature();
    ADCMeasurement();
}

static void vTimerCallback_SUSBUSTIMEOUT (xTimerHandle pxTimer)
{
   //Reset the communication state back to the header state
}

1 Ответ

0 голосов
/ 28 августа 2018

Не уверен, что вы подразумеваете под "вернул ошибку taskSCHEDULER_RUNNING". Когда и как вы получили эту ошибку?

Что касается создания таймеров; Вы выделили достаточно кучи для FreeRTOS (в вашем FreeRTOSConfig.h)?

...