cancel
Showing results for 
Search instead for 
Did you mean: 

Drawing Pictures with EmWin

mfrank9
Associate III
Posted on August 20, 2016 at 17:01

Hello

I am using StemWin on the StM32F429-Eval Board.

I used the GuiBuilder to define a dialog box where I added an image

widget including a jpeg format picure. The result is that dialog box is well displayes on the screen

but not the jpeg picure.

I tried different format but with the same result. 

However if I created an image with GUI_DrawBitmap() then it works fine.

I have found another user with the same problem.

http://forum.segger.com/index.php?page=Thread&threadID=1886

Seggers says that we should contact STM for this problem.

 

I hope you can help me.

#pictures #stemwin #dialog-box
5 REPLIES 5
slimen
Senior
Posted on August 22, 2016 at 15:05

Hi,

I think it can be a memory problem related to the JPEG memory requirement, 

Can you give some more info? E.g.:

- Which version of emWin are you using?  Are you using the last emWin version

- which RAM using ? Did you try increasing the RAM dedicated to emWin? 

It is known memory problems for JPEG, but was solved on 5.24a version, as mentioned in the Release notes for emWin (in Program corrections section) from this

http://www.keil.com/pack/doc/mw/graphic/html/release.html%20

 :

   

Version 5.24a:

 

3. Core:

 

If very short on memory under certain circumstances JPEG decoder could crash. Problem solved.

 

 

So, I recommend you using the latest emWin version, if it's not done.

Regards.
mfrank9
Associate III
Posted on August 23, 2016 at 23:23

Hi

-I have the version 5.28b which should be the latest version.

-I have two different boards. It dont´t work on both boards.

 I use the ''Hello World'' example and add a screen (dialog) with the Gui Builder.

 The RAM which is used on both boards is the SDRAM.

 

 In the lcdconf.c the RAM area is definded as

#define LCD_LAYER0_FRAME_BUFFER  ((int)0xC0200000)

#define LCD_LAYER1_FRAME_BUFFER  ((int)0xC0400000)  

mfrank9
Associate III
Posted on September 01, 2016 at 15:40

push

Selso LIBERADO
Associate III
Posted on December 15, 2016 at 20:28

Hello.

I am experiencing the same problem on discovery/ EVAL1 board

I based my project on the HSTemwin/HelloWorld (no OS) and tried with SW4 and Keil MDK 5.

emwin version is 5.32 (embbeded in ST32Cube F4 V1.14.0)

I tested BMP, JPEG, PNG (I compiled emwin_png). Only BMP works witth the IMAGE Widget functions.

I built for each the same screen (WINDOW + image + button) with the GUI builder.

I also added a function the test JPEG support with the JPEG API (Gui_JPEG_xxx) : it works.

To notice that I did not found a sample project that use the IMAGE_SetJPEG function().

The GUIconf file assign 150ko for emwin pool in internal SRAM (192ko available for the MCU).

The code generated by GUIbuilder to display Image is the following :

static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {

  { WINDOW_CreateIndirect, 'SRC1_272x480_JPG_', ID_WINDOW_0, 0, 0, 272, 480, 0, 0x0, 0 },

  { IMAGE_CreateIndirect, 'Logo', ID_IMAGE_0, 0, 60, 272, 131, 0, 0, 0 },

  // USER START (Optionally insert additional widgets)

  // USER END

};

static const U8 _acImage_0[11134] = { .... }

static void _cbDialog(WM_MESSAGE * pMsg) {

   ...

  switch (pMsg->MsgId) {

  case WM_INIT_DIALOG:

   ....

    hItem = WM_GetDialogItem(pMsg->hWin, ID_IMAGE_0);

    pData = _GetImageById(ID_IMAGE_0_IMAGE_0, &FileSize);

    IMAGE_SetJPEG(hItem, pData, FileSize);

   ...

}

WM_HWIN CreateSRC1_272x480_JPG_(void);

WM_HWIN CreateSRC1_272x480_JPG_(void) {

  WM_HWIN hWin;

  hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);

  return hWin;

}

When integrating in main, I used this code :

int main(void)

{  

    WM_HWIN wm_hwin = 0;

   ... Init : Hal, systemclock , HAL_TIM_Base_Init... everything that was in the demo sample

   ...

  GUI_Init();

 

  GUI_DispStringAt('Starting...', 0, 0);

 

  /* Initialize LCD and LEDs */

  GUI_DispStringAt('Initializing lcd...', 0, 12);

  BSP_Config();

  GUI_Initialized = 1;

 

  /* Activate the use of memory device feature */

  WM_SetCreateFlags(WM_CF_MEMDEV);

   GUI_SetBkColor(GUI_BLACK);

  GUI_Clear();

  wm_hwin = CreateWindow();

  /* Infinite loop */

  for(;;)

  {

        if( wm_hwin >= 0) // this is used to control that I am using GUIbuilder screen / my function with GUI_JPEG_Draw

        {        

            //GUI_Exec(); // Appel non bloquant    

            WM_Exec();

        }

        dispBenchmarkInfo(wm_hwin); // get from emwin the used memory

      GUI_Delay(100);

  }

}

Shall I allocate more memory in external SDRam ?

thanks for any help.

Posted on December 19, 2016 at 09:47

I shall add that I managed to display a PNG picture : libpng need more memory in head I had to allocate 1Mb for the GUI pool and did it using external SDRAM.

Doing so resolve the PNG trouble, but not JPEG (using the WM API).