Saturday, February 24th 2018, 11:04pm UTC+1

You are not logged in.

  • Login
  • Register

ttodorov

Beginner

Date of registration: Nov 12th 2016

Posts: 1

1

Tuesday, January 30th 2018, 11:43am

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/C++ Source code

1
2
3
4
5
6
7
8
9
10
11
12
#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/C++ Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#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/C++ Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#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);
}
ttodorov has attached the following files:
  • ili9341.c.txt (10.69 kB - 16 times downloaded - Last download: Feb 18th 2018, 8:35am)
  • LCDConf_stm32f429i.c.txt (41.52 kB - 19 times downloaded - Last download: Feb 18th 2018, 8:35am)
  • ltdc.c.txt (9.72 kB - 19 times downloaded - Last download: Yesterday, 12:46pm)

SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 496

2

Monday, February 5th 2018, 3:41pm

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/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