1
votes

I am using VisualGFX to develop a user interface for my STM32F429i-Discovery board. VisualGFX has built in freeRTOS usage with a GUITask being created to handle the GUI operations. I am then trying to create a new task called ControllerTask with the xTaskCreate API function from freeRTOS, same function as is used to create the GUITask.

However, as soon as I create this second Task the GUITask displays some weird values on my GUI and there is no functionality.

    int main(void){
    ...
    xTaskCreate(GUITask, (TASKCREATE_NAME_TYPE)"GUITask",
            configGUI_TASK_STK_SIZE,
            NULL,
            configGUI_TASK_PRIORITY,
            NULL);

    xTaskCreate (ControllerTask, (TASKCREATE_NAME_TYPE)"ControllerTask",
            configController_TASK_STK_SIZE,
            NULL,
            configController_TASK_PRIORITY,
            NULL); 
    vTaskStartScheduler();

    for (;;);

The above code shows the creation of the two tasks. The priority of the GUITask is higher as that of the ControllerTask. The next piece of code shows the Task implementation.

     static void GUITask(void* params)
      {
          touchgfx::HAL::getInstance()->taskEntry();
      }

     static void ControllerTask(void* params)
     {
       while(1)
       { 
         vTaskDelay(3000);
       }
     }

As can be seen the implementation of the ControllerTask at this moment in time is only Delaying the Task for roughly 3 seconds each time it is switched to.

However, the GUITask gets stuck and no GUI updates or interaction is possible.

1
Did you check the return value from xTaskCreate?D Krueger
@DKrueger, I have not checked that. How do I do it ? And what should it be ?0x436f72647265
Did you see The man....LPs
Are you asking how you check the return value of a function? That is a pretty basic C question, and using an RTOS is perhaps not the best starting point if you are not familiar with C. Have you read the API documentation for xTaskCreate() (freertos.org/a00125.html), because that shows the return value being tested? You can also implement a malloc() failed hook (Google it), which will get triggered if the allocation failed, or alternatively not use dynamic allocation at all.Richard

1 Answers

0
votes

Basically what is likely to happen is that your taskEntry() function never returns, and thus never gives back processing time to the kernel by using vTaskDelay or other Queue calls.

void taskEntry ( ) virtual Main event loop. Will wait for VSYNC signal, and then process next frame. Call this function from your GUI task.

Note This function never returns! Reimplemented in HALSDL2, and HALSDL.

If both task has same priority, or if your touchgfx has higher priority, you will get stuck.

To solve that issue, there are two ways.

  1. Is to implement the task with priorities, and set that task with the lowest priority of all.

  2. Enable the Idle task and implement the call on that method.