Thursday, October 19th 2017, 7:17am UTC+2

You are not logged in.

  • Login
  • Register

kenmux

Beginner

Date of registration: Jan 18th 2016

Posts: 36

1

Tuesday, August 8th 2017, 7:46am

UI not refreshing while callback called

Hello,

Now days, I encountered an annoying issue:

The UI stopped refreshing while the callback was called all the time.
I use a separate task calling GUI_Exec() once per 1ms, under FreeRTOS.
My emWin version is v5.42.

PS: If I add GUI_Exec() in the callback, this issue seems gone.
(But, it's not recommended by the manual (Chapter 17.4.5), right?)

So, what's wrong? Any ideas?
Please help! Thanks in advance!

Kenmux

dev1984

Beginner

Date of registration: Jul 17th 2017

Posts: 4

2

Thursday, September 7th 2017, 7:00am

GUI_Exec() not updating LCD buffer when used in FreeRTOS thread

I have a similar problem with FreeRTOS.
I am trying to retrofit the legacy single task code into 2 FReeRTOS tasks as below:


1. High Priority Fixed Frequency (10ms) Task: Mainly code related with control logic. Also, handles keys and code related to setting the widget and emWin window properties. Entire task executes in <1ms leaving about 9ms for low priority task before it is preempted by high priority task again.
2. Low Priority Continuous Task: Executes GUI_Exec() and GUI_X_ExecIdle(); in a continuous loop.

I have verified that both the tasks are scheduled correctly. But GUI_Exec() returns without rendering to the LCD buffer. I am using the STemWin library compiled for OS. I have followed all the recommendations in chapter 17 (Multitasking) of emWin user manual. Looking at call stack it looks like low priority task is not able to get the semaphore. But I am not entirely sure that is the problem because low priority task is getting a fair amount of processing time. What am I missing here? Can anybody help?

This post has been edited 3 times, last edit by "dev1984" (Sep 7th 2017, 7:07am)


dev1984

Beginner

Date of registration: Jul 17th 2017

Posts: 4

3

Friday, September 8th 2017, 1:25am

I am posting my code as it might be helpful to visualize my description in the previous post.


Snapshot of main() code:

C/C++ Source code

1
 osThreadDef(MyMainTask, MY_Main, osPriorityNormal, 0, 512/*32-bit words*/); MyMainTaskHandle = osThreadCreate(osThread(MyMainTask), NULL); osThreadDef(guiMainTask, GUI_Main, osPriorityNormal, 0, 512/*32-bit words*/);GuiMainTaskHandle = osThreadCreate(osThread(guiMainTask), NULL); SystemCoreClock = HW_CPU_CLK_HZ;/*Used by FreeRTOS to configure SysTick*/ osKernelStart(); while (1)  	{  	} 
[font='&quot'] [/font]


Task Function My_Main():

C/C++ Source code

1
  /* My main to run as rtos thread */  void MY_Main(void const * argument)  {  	TickType_t xLastWakeTime;     	xLastWakeTime = xTaskGetTickCount();        for (;;)  	{      	everyMainLoopSTasks();        	/*Handle key events, update emWin widget and window properties*/         	osDelayUntil( &xLastWakeTime, pdMS_TO_TICKS( 10 ) );     	}  	osThreadTerminate( NULL );  }

Task function GUI_Main():

C/C++ Source code

1
void GUI_Main(void const * argument){	TickType_t xLastWakeTime; 	xLastWakeTime = xTaskGetTickCount(); 	/* A task will normally be implemented as an infinite loop. */	for (;;)	{        	LCD_Main();     	  GUI_X_ExecIdle();	} 	osThreadTerminate( NULL );}

This post has been edited 1 times, last edit by "dev1984" (Sep 8th 2017, 1:31am)


dev1984

Beginner

Date of registration: Jul 17th 2017

Posts: 4

4

Tuesday, September 19th 2017, 12:16pm

Any suggestions segger?