My LCD screen gets stuck on my MCBSTM32F400

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

  • My LCD screen gets stuck on my MCBSTM32F400

    Hello,

    I'm doing a project in uV 4.7.0 using the Segger emWin Middlewear. Im trying to program the
    screen on my Keil Eval board to rotate between 3 images and never stop. I took the Tamplate
    from C:\Keil\ARM\Boards\Keil\MCBSTM32F400\emWin\Template and modified it.

    My problem is that after the images has been shown 4 times each, the screen get stuck on one of
    them. I think it has to do something with that I run out off memory. I tried using the
    GUI_MEMDEV commands but I can't seam to get it working.

    My code looks like:

    C Source Code

    1. /*********************************************************************
    2. * SEGGER Microcontroller GmbH & Co. KG *
    3. * Solutions for real time microcontroller applications *
    4. **********************************************************************
    5. * *
    6. * (c) 1996 - 2012 SEGGER Microcontroller GmbH & Co. KG *
    7. * *
    8. * Internet: www.segger.com Support: support@segger.com *
    9. * *
    10. **********************************************************************
    11. ** emWin V5.16 - Graphical user interface for embedded applications **
    12. All Intellectual Property rights in the Software belongs to SEGGER.
    13. emWin is protected by international copyright laws. Knowledge of the
    14. source code may not be used to write a similar product. This file may
    15. only be used in accordance with the following terms:
    16. The software has been licensed to ARM LIMITED whose registered office
    17. is situated at 110 Fulbourn Road, Cambridge CB1 9NJ, England solely
    18. for the purposes of creating libraries for ARM7, ARM9, Cortex-M
    19. series, and Cortex-R4 processor-based devices, sublicensed and
    20. distributed as part of the MDK-ARM Professional under the terms and
    21. conditions of the End User License supplied with the MDK-ARM
    22. Professional.
    23. Full source code is available at: www.segger.com
    24. We appreciate your understanding and fairness.
    25. ----------------------------------------------------------------------
    26. File : main.c
    27. Purpose : Main program Template
    28. ---------------------------END-OF-HEADER------------------------------
    29. */
    30. #include <stm32f4xx.h>
    31. #include "gui.h"
    32. #include "Dialog.h"
    33. #include <stdio.h>
    34. extern WM_HWIN CreateNO(void);
    35. extern WM_HWIN CreateWindow2(void);
    36. extern WM_HWIN Createwin3(void);
    37. GUI_MEMDEV_Handle hMem1;
    38. GUI_MEMDEV_Handle hMem2;
    39. GUI_MEMDEV_Handle hMem3;
    40. /*********************************************************************
    41. *
    42. * MainTask
    43. */
    44. void MainTask(void) {
    45. GUI_Init();
    46. }
    47. void GUI_me(void){
    48. GUI_SelectLayer(hMem1);
    49. hMem1=GUI_MEMDEV_Create(0,0,240,320);
    50. GUI_MEMDEV_Select(hMem1);
    51. CreateWindow2();
    52. GUI_MEMDEV_CopyToLCD(hMem1);
    53. GUI_MEMDEV_Clear(hMem1);
    54. GUI_MEMDEV_Delete(hMem1);
    55. }
    56. void GUI_me2(void){
    57. GUI_SelectLayer(hMem2);
    58. hMem2=GUI_MEMDEV_Create(0,0,240,320);
    59. GUI_MEMDEV_Select(hMem2);
    60. CreateNO();
    61. GUI_MEMDEV_CopyToLCD(hMem2);
    62. GUI_MEMDEV_Clear(hMem2);
    63. GUI_MEMDEV_Delete(hMem2);
    64. }
    65. void GUI_me3(void){
    66. GUI_SelectLayer(hMem3);
    67. hMem3=GUI_MEMDEV_Create(0,0,240,320);
    68. GUI_MEMDEV_Select(hMem3);
    69. Createwin3();
    70. GUI_MEMDEV_CopyToLCD(hMem3);
    71. GUI_MEMDEV_Clear(hMem3);
    72. GUI_MEMDEV_Delete(hMem3);
    73. }
    74. /*********************************************************************
    75. *
    76. * Main
    77. */
    78. int main (void) {
    79. MainTask();
    80. while(1){
    81. GUI_me();
    82. GUI_Delay(1000);
    83. GUI_me2();
    84. GUI_Delay(1000);
    85. GUI_me3();
    86. GUI_Delay(1000);
    87. }
    88. /*************************** End of file ****************************/
    Display All


    I'm using the Segger emWin GUI builder to create the images:
    WM_HWIN CreateNO(void);
    WM_HWIN CreateWindow2(void);
    WM_HWIN Createwin3(void);

    I think I'm runing out of memory. But the GUI_MEMDEV_Delete() doesn't seam to free up memory as I thought. Does anybody have an idea of how to get this to work?

    Best regards
    Björn Skånberg