STemWin528 + STM32F7-discovery, GUI flickering

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

  • STemWin528 + STM32F7-discovery, GUI flickering

    Hello.

    I'm testing StemWin5.28
    library. I created simple GUI with GUI Builder – window and two
    buttons.

    My hardware is
    STM32F7-discovery. After uploading the project into the kit I see
    flickering on the LCD with about 1 second period. After each
    flickering I see something resembling my GUI but very distorted.
    After about 2 minutes of such behavior the GUI became as it should
    be. I increased the STACK from 0x460 to 0x2000 (before this the
    situation was even worse).

    I attached the the GUI
    code and couple of distorted GUI (just to get the idea).

    What can I check?

    I checked the size of
    stack of ST Demo project with more complex graphics and it is only
    0x200...

    Source Code

    1. #include "DIALOG.h"
    2. /*********************************************************************
    3. *
    4. * Defines
    5. *
    6. **********************************************************************
    7. */
    8. #define ID_WINDOW_0 (GUI_ID_USER + 0x00)
    9. #define ID_BUTTON_0 (GUI_ID_USER + 0x01)
    10. #define ID_BUTTON_1 (GUI_ID_USER + 0x02)
    11. // USER START (Optionally insert additional defines)
    12. // USER END
    13. /*********************************************************************
    14. *
    15. * Static data
    16. *
    17. **********************************************************************
    18. */
    19. // USER START (Optionally insert additional static data)
    20. // USER END
    21. /*********************************************************************
    22. *
    23. * _aDialogCreate
    24. */
    25. static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
    26. { WINDOW_CreateIndirect, "Window", ID_WINDOW_0, 0, 0, 480, 272, 0, 0x0, 0 },
    27. { BUTTON_CreateIndirect, "Button", ID_BUTTON_0, 0, 0, 80, 20, 0, 0x0, 0 },
    28. { BUTTON_CreateIndirect, "Button", ID_BUTTON_1, 82, 58, 80, 20, 0, 0x0, 0 },
    29. // USER START (Optionally insert additional widgets)
    30. // USER END
    31. };
    32. /*********************************************************************
    33. *
    34. * Static code
    35. *
    36. **********************************************************************
    37. */
    38. // USER START (Optionally insert additional static code)
    39. // USER END
    40. /*********************************************************************
    41. *
    42. * _cbDialog
    43. */
    44. static void _cbDialog(WM_MESSAGE * pMsg) {
    45. int NCode;
    46. int Id;
    47. // USER START (Optionally insert additional variables)
    48. // USER END
    49. switch (pMsg->MsgId) {
    50. case WM_NOTIFY_PARENT:
    51. Id = WM_GetId(pMsg->hWinSrc);
    52. NCode = pMsg->Data.v;
    53. switch(Id) {
    54. case ID_BUTTON_0: // Notifications sent by 'Button'
    55. switch(NCode) {
    56. case WM_NOTIFICATION_CLICKED:
    57. // USER START (Optionally insert code for reacting on notification message)
    58. // USER END
    59. break;
    60. case WM_NOTIFICATION_RELEASED:
    61. // USER START (Optionally insert code for reacting on notification message)
    62. // USER END
    63. break;
    64. // USER START (Optionally insert additional code for further notification handling)
    65. // USER END
    66. }
    67. break;
    68. case ID_BUTTON_1: // Notifications sent by 'Button'
    69. switch(NCode) {
    70. case WM_NOTIFICATION_CLICKED:
    71. // USER START (Optionally insert code for reacting on notification message)
    72. // USER END
    73. break;
    74. case WM_NOTIFICATION_RELEASED:
    75. // USER START (Optionally insert code for reacting on notification message)
    76. // USER END
    77. break;
    78. // USER START (Optionally insert additional code for further notification handling)
    79. // USER END
    80. }
    81. break;
    82. // USER START (Optionally insert additional code for further Ids)
    83. // USER END
    84. }
    85. break;
    86. // USER START (Optionally insert additional message handling)
    87. // USER END
    88. default:
    89. WM_DefaultProc(pMsg);
    90. break;
    91. }
    92. }
    93. /*********************************************************************
    94. *
    95. * Public code
    96. *
    97. **********************************************************************
    98. */
    99. /*********************************************************************
    100. *
    101. * CreateWindow
    102. */
    103. WM_HWIN CreateWindow(void);
    104. WM_HWIN CreateWindow(void) {
    105. WM_HWIN hWin;
    106. hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
    107. return hWin;
    108. }
    109. // USER START (Optionally insert additional public code)
    110. // USER END
    111. /*************************** End of file ****************************/
    112. /*********************************************************************
    113. *
    114. * MainTask
    115. */
    116. void MainTask(void) {
    117. GUI_Init();
    118. while(1)
    119. {
    120. CreateWindow();
    121. GUI_Delay(500);
    122. }
    123. }
    Display All

    forum.segger.com/index.php?pag…2e05bdaa3c27f9aa9ca00251b
    forum.segger.com/index.php?pag…6e4b604b1c9eaf9e7d8c7ff2a

    I changed the code as was suggested in the "Flickering Issue with TEXT_SetText()" thread. The flickering disappeared, but the image became stedily incorrect. Here it is
    forum.segger.com/index.php?pag…ccc502ee4da4c0277e7482dc0
    The part of the code changed:

    Source Code

    1. void MainTask(void) {
    2. GUI_Init();
    3. CreateWindow();
    4. while(1)
    5. {
    6. GUI_Delay(500);
    7. }
    8. }
    Images
    • IMG_20160123_125150.jpg

      35.1 kB, 979×734, viewed 902 times
    • IMG_20160123_125158.jpg

      36.86 kB, 979×734, viewed 752 times
    • IMG_20160123_135607.jpg

      77.08 kB, 979×734, viewed 855 times

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

  • Hello,

    please try to disable the data cache. For example by a call of SCB_DisableDCache() in your main.c directly after CPU_CACHE_Enable().
    It is necessary that emWin is able to write uncached into the memory.

    Regards,
    Sven
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hello Sven.
    Thank you for your answer. It have solved the problem. How can I check whether it will influence other functionalities?

    SEGGER - Schoenen wrote:

    Hello,

    please try to disable the data cache. For example by a call of SCB_DisableDCache() in your main.c directly after CPU_CACHE_Enable().
    It is necessary that emWin is able to write uncached into the memory.

    Regards,
    Sven