2018-05-25 10:15 AM
Hello to everyone,
let me please ask a question.
I'm using
STemWinonSTM32F777ZIcontroller for GUI development on a custom board.The board has SDRAM (MT48LC32M16A2, 512 Mbit) connected to the controller throughFMC Bank1(start address is0xC0000000).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...In
CUIConf.c:...#define GUI_NUMBYTES 0x0400000...// in
GUI_X_Init():...static U32aMemory[GUI_NUMBYTES / 4] __attribute__ ((section(''.sdram_data'')));...As we can see
aMemoryassigned to ''.sdram_data'' section configured in linker *.ld file. It has a start address at0xC0000000and a size of0x0400000, so it wouldn't conflict with a frame buffer memory for layer 0 which has a start address at0xC0400000. Watch window in IDE shows these correct addresses (aMemoryshows0xC0000000andlayer_prop[0].addressshows0xC0400000).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
100MHz, and LTDC clock is50MHz.I'm 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 the 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 a same GIF picture (''This is a GIF''), unoptimized it as described in emWin manual (exactly in emWin
UM03001, not in StemWin manualStemWin532.pdf) then again used Bitmap Converter and converted the GIF to C-array for using withGUI_GIF_Draw().And got this one:
Seems that only few first lines of the GIF displayed.
GUI_GIF_Draw()returned 1. That is error.
Next in function
GUI_X_Config()I reconfiguredaMemorylocation 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 KBas internal RAM is only512 KBon the chip:#define GUI_NUMBYTES(300 * 1024)...Frame buffer location for layer 0 remains unchanged:
#define LCD_LAYER0_FRAME_BUFFER 0xC0400000 //in SDRAMC-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
aMemoryallocated in SDRAM? First I thought that problem is in SDRAM, butGUI_BMP_Draw()andGUI_DrawBitmap()works properly regardless ofaMemoryallocation. May be I missed some options when I configured STemWin? Or while peripheral configuration (DMA2D, FMC, MPU regions...)?
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 a code sections if it is needed.
Thanks for your time.
2018-05-27 03:28 AM
Do you have the MPU configured as write-through for the SDRAM region? its the only thing I can think of, with my limited experience
2018-05-27 11:08 AM
add
WM_MULTIBUF_Enable(0);
2018-05-28 10:23 AM
Ne rabotaet (
Doesn't work. I do not use Window Manager, just drawing a GIF with GUI_GIF_Draw() after GUI_Init().
I generated a new project with STM32CUBEMX selecting 'GRAPHICS->STemWin' and configuring all the layer's options, hoping Cube will generate a proper 'LCD_Conf.c' file (if the problem in this file). Actually I had to generate the project on STM32F767ZI and change it manually for STM32F777ZI (somehow, the Cube has not 'GRAPHICS' option for this chip).
I also tried various combinations of MPU regions configuration.
But the problem still exist (
2018-05-28 10:27 AM
Hello, John!
Oh, I've been making a mess with this discussion. I was certain I deleted this question and created a new one. But to my surprise this question still exist ))
There is a new one:
https://community.st.com/0D50X00009XkWIYSA3
This one is updated and there are some screenshots of peripheral configuration including MPU regions.
Can you please tell me, is MPU properly configured or not?
Thank you!
2018-05-28 10:28 AM
my project with GIF (attach)
2018-05-29 12:27 AM
WM_MULTIBUF_Enable(0):
WM_MULTIBUF_Enable(1):
The same behaviours. The wings are shown and animated in both cases. And also there is my problem with a bad GIF drawing.
WindowDLG.c is generated by GUI_Builder. It has a hardware abstract code and it doesn't solve the problem.
2018-05-29 03:59 AM
Is your picture distorted?
Very strange...
I have an undistorted picture in both cases, for
WM_MULTIBUF_Enable(0); &
WM_MULTIBUF_Enable(1);
2018-05-29 07:06 AM
Seems that problem in wrong MPU configuration. Not solved yet...
2018-05-31 08:37 PM
#define START_GIF 0xD0600000
#define NEXT_ADDRESS_GIF(A) START_GIF+(A)void GIF (void)
{ GUI_GIF_IMAGE_INFO ImageInfo = {0}; // Info structure of one particular GIF image of the GIF file GUI_GIF_INFO GifInfo = {0}; // Info structure of GIF file int i; int j; int XPos; int YPos; uint32_t selByt = 0; fresult=f_open(&MyFile,'123.gif', FA_READ); do { f_read(&MyFile, (char*)NEXT_ADDRESS_GIF(selByt), 512, &bytesread); selByt+=512; }while(bytesread > 511); GUI_GIF_GetInfo((char*)START_GIF, MyFile.fsize, &GifInfo); WM_MULTIBUF_Enable(1); while(1) { for (j = 0; j < GifInfo.NumImages; j++) { GUI_GIF_DrawSub((char*)START_GIF, MyFile.fsize,400, 100, j); // Draw sub image GUI_GIF_GetImageInfo((char*)START_GIF, MyFile.fsize, &ImageInfo, j); // Get sub image information } }}static void MPU_Config (void) { MPU_Region_InitTypeDef MPU_InitStruct; /* Disable the MPU */ HAL_MPU_Disable(); /* Configure the MPU attributes for SDRAM */ MPU_InitStruct.Enable = MPU_REGION_ENABLE; MPU_InitStruct.BaseAddress = 0xD0000000; MPU_InitStruct.Size = MPU_REGION_SIZE_8MB; MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS; MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE; MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE; MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE; MPU_InitStruct.Number = MPU_REGION_NUMBER0; MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL1; MPU_InitStruct.SubRegionDisable = 0x00; MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE; HAL_MPU_ConfigRegion(&MPU_InitStruct); /* Enable the MPU */ HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT); }
If you want to use the GUI_GIF_Draw () function, you need to monitor the frame addresses yourself!