FreeRTOS and emwin

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

  • FreeRTOS and emwin

    Hi there,

    I have a custom pcb with an LPC4367 onboard and im using a DisplayTech DTO24CTFT 240x320 display with ILI9341 controller.

    With the help found in this forum i managed to have it working using RGB interface.

    So far my tests were made in a single task environment and everything has worked fine.

    I tried to port my implementation in a FreeRTOS environment but some issues occur.

    Quoting from emwin manual v5.38:
    Single task system (superloop)
    The entire program runs in one superloop. Normally, all software components are
    periodically called. Interrupts must be used for real time parts of the software since
    no real time kernel is used.
    Multitask system: one task calling emWin
    A real time kernel (RTOS) is used, but only one task calls emWin functions. From the
    graphic software’s point of view, it is the same as being used in a single task system.
    Multitask system: multiple tasks calling emWin
    A real time kernel (RTOS) is used, and multiple tasks call emWin functions. This
    works without a problem as long as the software is made thread-safe, which is done
    by enabling multitask support in the configuration and adapting the kernel interface
    routines. For popular kernels, the kernel interface routines are readily available.
    So as mentioned above in a multitask environment when one task calls emwin it is the same as being used in a single task system.

    The only thing i modify is in GUI_X.c and i replace these methods taken from single task environment:

    Source Code

    1. int GUI_X_GetTime(void) {
    2. return (int)systick_timems;
    3. }
    4. void GUI_X_Delay(int ms) {
    5. int tEnd = (int) systick_timems + ms;
    6. while ((tEnd - (int)systick_timems) > 0);
    7. }



    with these lines:

    Source Code

    1. int GUI_X_GetTime(void) {
    2. return ((int)xTaskGetTickCount());
    3. }
    4. void GUI_X_Delay(int ms) {
    5. vTaskDelay(ms);
    6. }



    As a result LCD displays the desired graphic all right but the screen is flickering all the time and it kind of reboots.
    (Etc a timer is displayed and after flickering the timer restarts-does not continue from where it was.)

    Only one task is using emwin and researching emwin manual couldn't find something more specific of how to handle this isuee.

    Any help would be much appreciated!

    Thanks a lot in advance!