UI not refreshing while callback called

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • 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
  • 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?

    The post was edited 3 times, last by dev1984 ().

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


    Snapshot of main() code:

    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 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 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 );}

    The post was edited 1 time, last by dev1984 ().