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:
Display All
My dma2d.c file:
Display All
The GUIConf.c:
Display All
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
- #define FB_XSIZE_PHYS 240
- #define FB_YSIZE_PHYS 320
- #define FB_LCD_LAYER0_MEM_START 0xd0040000
- #define FB_LCD_LAYER1_MEM_START 0xd0070000
- #define FB_SDRAM_DEVICE_ADDR 0xd0000000
- #define FB_ILI9341_HSYNC 10
- #define FB_ILI9341_HBP 20
- #define FB_ILI9341_HFP 10
- #define FB_ILI9341_VSYNC 2
- #define FB_ILI9341_VBP 2
- #define FB_ILI9341_VFP 4
- #define FB_GUI_NUMBYTES (1024 * 256)
My dma2d.c file:
C Source Code
- #include "dma2d.h"
- DMA2D_HandleTypeDef hdma2d;
- /* DMA2D init function */
- void MX_DMA2D_Init(void)
- {
- hdma2d.Instance = DMA2D;
- hdma2d.Init.Mode = DMA2D_M2M;
- hdma2d.Init.ColorMode = DMA2D_OUTPUT_RGB565;
- hdma2d.Init.OutputOffset = 0;
- hdma2d.LayerCfg[1].InputOffset = 0;
- hdma2d.LayerCfg[1].InputColorMode = DMA2D_INPUT_RGB565;
- hdma2d.LayerCfg[1].AlphaMode = DMA2D_NO_MODIF_ALPHA;
- hdma2d.LayerCfg[1].InputAlpha = 0;
- if (HAL_DMA2D_Init(&hdma2d) != HAL_OK)
- {
- _Error_Handler(__FILE__, __LINE__);
- }
- if (HAL_DMA2D_ConfigLayer(&hdma2d, 1) != HAL_OK)
- {
- _Error_Handler(__FILE__, __LINE__);
- }
- }
- void HAL_DMA2D_MspInit(DMA2D_HandleTypeDef* dma2dHandle)
- {
- if(dma2dHandle->Instance==DMA2D)
- {
- /* DMA2D clock enable */
- __HAL_RCC_DMA2D_CLK_ENABLE();
- }
- }
- void HAL_DMA2D_MspDeInit(DMA2D_HandleTypeDef* dma2dHandle)
- {
- if(dma2dHandle->Instance==DMA2D)
- {
- /* Peripheral clock disable */
- __HAL_RCC_DMA2D_CLK_DISABLE();
- }
- }
The GUIConf.c:
C Source Code
- #include "GUI.h"
- #include "main.h"
- void GUI_X_Config(void) {
- //
- // 32 bit aligned memory area
- //
- volatile U32 *aMemory = (U32*)(FB_SDRAM_DEVICE_ADDR);
- //
- // Assign memory to emWin
- //
- GUI_ALLOC_AssignMemory((U32*)aMemory, FB_GUI_NUMBYTES);
- //
- // Set default font
- //
- GUI_SetDefaultFont(GUI_DEFAULT_FONT);
- }