Screen cut off after moving from STemWin 5.32 to 5.40

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

    • Screen cut off after moving from STemWin 5.32 to 5.40

      Hello,

      I have a weird problem with emWin/STemWin after moving from version 5.32 to 5.40... The odd thing about it is that I did not change any of my code, just updated the binary object that I am linking to for use of emWin, as provided by the ST BSP 1.19.0. Old file was STemWin532_CM4_OS_GCC_ot.a, the new one is STemWin540_CM4_OS_GCC_ot.a.

      I have attached 2 pictures to illustrate the problem. The first one is a screenshot as the screen should be (using emWin v5.32); the other one is how it looks after linking to v5.40. I am using ST32F429II, with the same ILI9341 display as on the STM32F420 DISCOVERY board, driven in 16bit parallel mode. My setup uses the LTDC and DMA2D peripherals, with FreeRTOS and emWIn as provided by ST. I am also going to attach my LCD relevant code as well.

      One other odd thing is that any bitmaps I show are presented with the correct colors, but if I use any of the predefined GUI_XYZ colors, the red and the blue are swapped. I haven't figured this out yet, but since this particular behavior is consistent between the 2 versions, I don't believe it is relevant to the main issue. Feel free to correct me, if you feel I am wrong.

      My sources are all inlined, if rather long. Could anyone spot the issue? Much appreciated!



      The biggest files - ltdc.c, ili9342.c, and LCDConf.c are attached, as otherwise they would not fit within the 10k characters limits of a single message ;)

      To begin with, I have the following in my main.h file:

      C Source Code

      1. #define FB_XSIZE_PHYS 240
      2. #define FB_YSIZE_PHYS 320
      3. #define FB_LCD_LAYER0_MEM_START 0xd0040000
      4. #define FB_LCD_LAYER1_MEM_START 0xd0070000
      5. #define FB_SDRAM_DEVICE_ADDR 0xd0000000
      6. #define FB_ILI9341_HSYNC 10
      7. #define FB_ILI9341_HBP 20
      8. #define FB_ILI9341_HFP 10
      9. #define FB_ILI9341_VSYNC 2
      10. #define FB_ILI9341_VBP 2
      11. #define FB_ILI9341_VFP 4
      12. #define FB_GUI_NUMBYTES (1024 * 256)
      Display All


      My dma2d.c file:

      C Source Code

      1. #include "dma2d.h"
      2. DMA2D_HandleTypeDef hdma2d;
      3. /* DMA2D init function */
      4. void MX_DMA2D_Init(void)
      5. {
      6. hdma2d.Instance = DMA2D;
      7. hdma2d.Init.Mode = DMA2D_M2M;
      8. hdma2d.Init.ColorMode = DMA2D_OUTPUT_RGB565;
      9. hdma2d.Init.OutputOffset = 0;
      10. hdma2d.LayerCfg[1].InputOffset = 0;
      11. hdma2d.LayerCfg[1].InputColorMode = DMA2D_INPUT_RGB565;
      12. hdma2d.LayerCfg[1].AlphaMode = DMA2D_NO_MODIF_ALPHA;
      13. hdma2d.LayerCfg[1].InputAlpha = 0;
      14. if (HAL_DMA2D_Init(&hdma2d) != HAL_OK)
      15. {
      16. _Error_Handler(__FILE__, __LINE__);
      17. }
      18. if (HAL_DMA2D_ConfigLayer(&hdma2d, 1) != HAL_OK)
      19. {
      20. _Error_Handler(__FILE__, __LINE__);
      21. }
      22. }
      23. void HAL_DMA2D_MspInit(DMA2D_HandleTypeDef* dma2dHandle)
      24. {
      25. if(dma2dHandle->Instance==DMA2D)
      26. {
      27. /* DMA2D clock enable */
      28. __HAL_RCC_DMA2D_CLK_ENABLE();
      29. }
      30. }
      31. void HAL_DMA2D_MspDeInit(DMA2D_HandleTypeDef* dma2dHandle)
      32. {
      33. if(dma2dHandle->Instance==DMA2D)
      34. {
      35. /* Peripheral clock disable */
      36. __HAL_RCC_DMA2D_CLK_DISABLE();
      37. }
      38. }
      Display All



      The GUIConf.c:

      C Source Code

      1. #include "GUI.h"
      2. #include "main.h"
      3. void GUI_X_Config(void) {
      4. //
      5. // 32 bit aligned memory area
      6. //
      7. volatile U32 *aMemory = (U32*)(FB_SDRAM_DEVICE_ADDR);
      8. //
      9. // Assign memory to emWin
      10. //
      11. GUI_ALLOC_AssignMemory((U32*)aMemory, FB_GUI_NUMBYTES);
      12. //
      13. // Set default font
      14. //
      15. GUI_SetDefaultFont(GUI_DEFAULT_FONT);
      16. }
      Display All
      Files
      • ili9341.c.txt

        (10.69 kB, downloaded 447 times, last: )
      • LCDConf_stm32f429i.c.txt

        (41.52 kB, downloaded 347 times, last: )
      • ltdc.c.txt

        (9.72 kB, downloaded 321 times, last: )
    • Hi,

      Unfortunately, I don't have any idea regarding the split screen, yet. One thing I could image is a wrong frame buffer address. But if you didn't changed anything here between 5.32 and 5.40 I doubt this is the issue.

      Regarding the colors, please try to add the following line to yor GUIConf.c:

      C Source Code

      1. #define GUI_USE_ARGB (1)


      In general it shouldn't have an effect when using a pre-compiled library but it might be possible that the libraries from V5.32 where build without this define and the new ones are. Now, if you set this define the configuration file fit to the libraries again and the colors are defined properly.

      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.