cancel
Showing results for 
Search instead for 
Did you mean: 

stemwin gui without external ram

er3481
Senior
Posted on August 09, 2016 at 15:04

Hi,

I want to use stemwin gui library with my stm32f429 board without any external ram for driving 320*240 tft LCD, so i will use mcu internal ram. when i use ''GUI_DispString(''Hello world!'')'' function , i can not see anything on the screen. For discovery board there is a external sdram and in ''LCDConf.c'' file the frame buffer is defined as :

#define LCD_LAYER0_FRAME_BUFFER ((uint32_t)0xD0200000)

So, if this is the problem for my board ( i am not sure), what must this value be ? Any advise ? ( when i use the value '' 0x20000000 for buffer adress that is the mcu internal ram adress, the code crashes.)

11 REPLIES 11
daemynnur
Associate II
Posted on August 11, 2016 at 13:34

Hi rapid84,

STM32F4 SRAM is from 0x20000000 to 0x2002FFFF ( 192KB)

you've set your Buffer Start @ 0x2002B001

as per my previous, unless you've changed the colour format settings of emWin, it'll probably be 32bits (4 byetes) per pixel.

so the 320x240 pixel display will need 300K of memory for the buffer

actual memory mapped to the buffer will only be 0x0x2002B001 to 0x2002FFFF (which is only 20KB,... well 2 bytes under actually)

The GUI & LCD driver won't care that there isn't actually any memory where the buffer is mapped to, the GUI will just write to empty space & the display will show nothing, where there is no RAM

so, 20K @ 4 bytes per pixel is 5120 pixels, which on the raster scan of the display is only the top 21 lines of the display

that seems to fit what you're getting.

as for the colour (red vs blue)

I read something (in the emWin manual I think) that the GUI uses ABGR8888 (Alpha, Blue, Green, Red) format while the LCD driver in the stm32F4 uses ARGB8888 (Alpha, Red, Green, Blue),..  so effectively red & blue are swapped over, which is probably what's causing it.

if you want to get this to work (e.g full screen buffer), you'll need to find out how to change emWin to an 8 bit per pixel format and set & set your buffer address to 0x2001D400

That'll leave you 117K of ram for everything else, which should be OK, but you'll have to change the amount allocated to the GUI as you've currently got that at 150K

(if you're not looking to use emWin's 'memory devices' (for sprites, floating windows or the like) & just want to do basic text & line-draw etc, you should be able to set that to 20K or less.

Cheers,.. Daemy

er3481
Senior
Posted on August 11, 2016 at 15:44

Hi @Daemy

There are only three defines in Hal_LTDC for 8bpp format:

#define LTDC_PIXEL_FORMAT_L8                        ((uint32_t)0x00000005U)      /*!< L8 LTDC pixel format       */

#define LTDC_PIXEL_FORMAT_AL44                      ((uint32_t)0x00000006U)      /*!< AL44 LTDC pixel format     */

#define LTDC_PIXEL_FORMAT_AL88                      ((uint32_t)0x00000007U)      /*!< AL88 LTDC pixel format     */

I have tried all of them but there no colored pixels on the screen, just white and black. If there is another format define for 8bpp colored format can you give advise me?