Hello to everyone,
let me please ask a question.
I'm using STemWin on STM32F777ZI controller for GUI development on a custom board.
The board has SDRAM (MT48LC32M16A2, 512 Mbit) connected to the controller through FMC Bank1 (start address is 0xC0000000).
The 10.4 inch display (1024x768) is connected to the controller through LTDC.
I'm using Atollic True Studio IDE.
Some configuration options in LCDConf.c:
#define COLOR_CONVERSION_0 GUICC_M565
#define DISPLAY_DRIVER_0 GUIDRV_LIN_16
#define GUI_NUM_LAYERS 1
#define LCD_LAYER0_FRAME_BUFFER 0xC0400000
#define LCD_LAYER1_FRAME_BUFFER 0xC0800000
#define GUI_NUMBYTES 0x0400000
// in GUI_X_Init():
static U32 aMemory[GUI_NUMBYTES / 4] __attribute__ ((section(".sdram_data")));
As we can see aMemory assigned to ".sdram_data" section configured in linker *.ld file. It has a start address at 0xC0000000 and a size of 0x0400000, so it wouldn't conflict with a frame buffer memory for layer 0 which has a start address at 0xC0400000. Watch window in IDE shows these correct addresses (aMemory shows 0xC0000000 and layer_prop.address shows 0xC0400000).
I've also read the LTDC manual from ST (AN4861) attentively and configured all the recommendations that described in this manual (SDRAM and LTDC clock restrictions and MPU regions configuration on SDRAM and internal RAM). SDRAM clock is 100 MHz, and LTDC clock is 50 MHz.
I successfully configured and initialized STemWin ("Hello, world" etc... basical drawing functions from 2D graphical library...)
After that I made a simple 1024x768 BMP picture in GIMP (Green text "This is a BMP" on a yellow background), then I optimized it using Bitmap Converter, then converted it to C-array using Bin2C for GUI_BMP_Draw() function and finally got it on the screen:
Next I made the same GIF picture ("This is a GIF"), unoptimized it as described in emWin manual (exactly in Segger emWin UM03001, not in STemWin manual StemWin532.pdf) then again used Bitmap Converter and converted the GIF to C-array for using with GUI_GIF_Draw().
And got this one:
Seems that only few first lines of the GIF displayed. GUI_GIF_Draw() returned 1. That is an error.
Next in function GUI_X_Config() I reconfigured aMemory location to its default address in internal RAM.
static U32 aMemory[GUI_NUMBYTES / 4]; // __attribute__ ... deleted. Watch window shows 0x20001308 address.
Had to reduce the size of aMemory to 300 KB as internal RAM is only 512 KB on the chip:
#define GUI_NUMBYTES (300 * 1024)
Frame buffer location for layer 0 remains unchanged:
#define LCD_LAYER0_FRAME_BUFFER 0xC0400000 // in SDRAM
C-array containing GIF data also remains unchanged. The only change is aMemory relocation from SDRAM to internal RAM.
And got it:
GUI_GIF_Draw() returned 0. Works fine.
Can anyone suggest what is wrong with the drawing a GIF with aMemory allocated in SDRAM? First I thought that problem is in SDRAM, but GUI_BMP_Draw() and GUI_DrawBitmap() work properly regardless of aMemory allocation. May be I missed some options when I configured STemWin? Or while configurating peripherals (DMA2D, FMC, MPU regions...)?
Some configuration screens from STM32CUBEMX.
Color frame buffer start address for Layer 0 reassigned to 0xC0400000 in LDC_X_Config()
It is critical for my development to use GIFs as they have compact size and the board has only internal flash on the chip (2 MB).
In addition, I'm going to use Window Manager and use GIFs as background images with different widgets over it. So I need to use Memory Devices for fast painting when invalidating windows and I should have sufficient RAM for that purposes as internal RAM is not enough.
I can provide an additional code sections if it is needed.
Thanks for your time.