2019-06-18 02:08 AM
Hello,
I have a basic touchgfx project working through designer and IAR. But when I add another FreeRTOS task, the task I add does not run. If I comment out the touchgfx task, my task runs just fine. I've adjusted priorities and that does not work.
This is the main.cpp code I've added:
xTaskCreate(ShellTask, (TASKCREATE_NAME_TYPE)"ShellTask",
configGUI_TASK_STK_SIZE,
NULL,
configGUI_TASK_PRIORITY+1,
NULL);
xTaskCreate(GUITask, (TASKCREATE_NAME_TYPE)"GUITask",
configGUI_TASK_STK_SIZE,
NULL,
configGUI_TASK_PRIORITY,
NULL);
Here is my shell_process.cpp code:
FrontendApplication* App = static_cast<FrontendApplication*>(Application::getInstance());
int myScreen = 1;
void ShellTask( void * pvParameters )
{
for( ;; )
{
vTaskDelay(10000);
if(myScreen == 0)
{
App->gotoScreen1ScreenNoTransition();
myScreen = 1;
}
else
{
App->gotoScreen2ScreenNoTransition();
myScreen = 0;
}
}
}
The task is very simple, transition screens every 10 seconds. When I run this task with the touchgfx task and set a breakpoint on vTaskDelay() it is never getting triggered. I've followed similar examples that were online and I'm not sure what is wrong. Any help is greatly appreciated.
Also, even though this task isn't running, the touchgfx application works correctly. I have buttons that toggle through the screens as well. That all works.
Thanks.
2019-06-18 03:04 PM
Hi,
Try simplifying your task and seeing if you can start it without any TouchGFX code. Without knowing the details, i wouldn't expect this to work. TouchGFX is running in a different context. If you wanted to switch screens, i'd send a message through a queue which is received in Model::tick(). Depending on the message i'd then do the transition.
/Martin
2019-06-18 04:01 PM
I removed the touchgfx code and it works. So if the task is just delaying and not running the touchgfx code, all is fine. Perhaps there is a mutual exclusion issue with the calls into the App from my task context. I saw the above example on-line somewhere and had thought that was a working example of screen switching.
If messages into the model is the preferred method, I'll pursue that, it makes sense. I believe I did see some button GPIO example you had posted regarding messages to the Model.
/Brent
2019-06-19 12:37 AM
Hi, yes, you're in a different task context so you cannot use TouchGFX in that way. Check some of the examples in the Hardware integration thread and you'll see how to do the same thing using queues
/Martin