2022-10-07 01:34 AM
Hi, I have initialized 1 layer in 800 * 480 resolution, and I also I have initialized DMA2D for this layer. I got 2 problems:
1- when it loads my logo , I see some lines which I can't understand how they come!!
for this: some horizontal lines appeared on my back ground just in logo resolution and for this I checked my sdram configuration and LTDC initialization.
I use F429ZGT6.
2- now I want to clear the LCD and loads it with six ball images in 90 * 86 resolution...
but it doesn't show anything....
Can some one help me?
What should I do to show 6 balls current layer.
here is my code:
// enable layer 1 ----> configuration in Reg_setup.h
LTDC_Cmd(ENABLE);
LTDC_LayerCmd(LTDC_Layer1, ENABLE);
LTDC_ReloadConfig(LTDC_IMReload);
// DMA2D initialization:
DMA2D_InitTypeDef DMA2D_InitStruct;
DMA2D_FG_InitTypeDef DMA2D_FG_InitStruct;
DMA2D_BG_InitTypeDef DMA2D_BG_InitStruct;
DMA2D_DeInit();
DMA2D_InitStruct.DMA2D_Mode = DMA2D_M2M_BLEND;
DMA2D_InitStruct.DMA2D_CMode = DMA2D_RGB565;
DMA2D_InitStruct.DMA2D_OutputGreen = 0x00;
DMA2D_InitStruct.DMA2D_OutputBlue = 0x00;
DMA2D_InitStruct.DMA2D_OutputRed = 0x00;
DMA2D_InitStruct.DMA2D_OutputAlpha = 255;
DMA2D_InitStruct.DMA2D_OutputMemoryAdd =SDRAM_START_ADR+ (800*130 * 2)+(220 *2);//(uint32_t)T;
DMA2D_FG_InitStruct.DMA2D_FGO = 0x00 ;
DMA2D_FG_InitStruct.DMA2D_FGMA =(uint32_t)T2;
DMA2D_FG_InitStruct.DMA2D_FGCM = CM_RGB565 ;
DMA2D_FG_InitStruct.DMA2D_FGPFC_ALPHA_MODE=COMBINE_ALPHA_VALUE;
// DMA2D_FG_InitStruct.DMA2D_FGPFC_ALPHA_VALUE = j ;
DMA2D_FG_InitStruct.DMA2D_FGC_BLUE = 0x00 ;
DMA2D_FG_InitStruct.DMA2D_FGC_GREEN = 0 ;
DMA2D_FG_InitStruct.DMA2D_FGC_RED = 0x00 ;
DMA2D_InitStruct.DMA2D_OutputOffset =800-340;
DMA2D_InitStruct.DMA2D_NumberOfLine = 240;
DMA2D_InitStruct.DMA2D_PixelPerLine = 340;
// logo 340*240 -----> in center & fading away
DMA2D_BG_InitStruct.DMA2D_BGO = 800-340 ;
DMA2D_BG_InitStruct.DMA2D_BGMA =SDRAM_START_ADR + (800*130 * 2)+(220 *2);
DMA2D_BG_InitStruct.DMA2D_BGCM = CM_RGB565 ;
DMA2D_BG_InitStruct.DMA2D_BGPFC_ALPHA_MODE=REPLACE_ALPHA_VALUE ;
DMA2D_BG_InitStruct.DMA2D_BGPFC_ALPHA_VALUE = 255 ;
DMA2D_BG_InitStruct.DMA2D_BGC_BLUE = 0x00 ;
DMA2D_BG_InitStruct.DMA2D_BGC_GREEN = 0 ;
DMA2D_BG_InitStruct.DMA2D_BGC_RED = 0x00 ;
DMA2D_Init(&DMA2D_InitStruct);
DMA2D_FGConfig(&DMA2D_FG_InitStruct);
DMA2D_BGConfig(&DMA2D_BG_InitStruct);
// DMA2D_Suspend(DISABLE);
// DMA2D_FGStart(ENABLE);
// DMA2D_BGStart(ENABLE);
/* Start Transfer */
DMA2D_StartTransfer();
/* Wait for CTC Flag activation */
while(DMA2D_GetFlagStatus(DMA2D_FLAG_TC) == RESET){}
for(i=0;i<=10;i++){
j = 255- (25*i);
DMA2D_FG_InitStruct.DMA2D_FGPFC_ALPHA_VALUE = j ;
Delay_us(1000000);
DMA2D_Init(&DMA2D_InitStruct);
DMA2D_FGConfig(&DMA2D_FG_InitStruct);
DMA2D_StartTransfer();
/* Wait for CTC Flag activation */
while(DMA2D_GetFlagStatus(DMA2D_FLAG_TC) == RESET){}
LTDC_ReloadConfig(LTDC_IMReload); // logo must be refreshed
}
// logo------> deactivated
DMA2D_Suspend(ENABLE);
// clear transfer complete flag
DMA2D_ClearFlag(DMA2D_FLAG_TC);
DMA2D_Suspend(DISABLE);
//*********************************************************************************
Delay_us(1000000);
// section 2:
LCD_Clear(LCD_COLOR_WHITE);
LTDC_Cmd(ENABLE);
LTDC_LayerCmd(LTDC_Layer1, ENABLE);
LTDC_ReloadConfig(LTDC_IMReload);
//
DMA2D_Suspend(DISABLE);
// DMA2D_StructInit(&DMA2D_InitStruct);
//
// DMA2D_DeInit();
DMA2D_InitStruct.DMA2D_Mode = DMA2D_M2M_BLEND;
DMA2D_InitStruct.DMA2D_CMode = DMA2D_RGB565;
DMA2D_InitStruct.DMA2D_OutputGreen = 0x00;
DMA2D_InitStruct.DMA2D_OutputBlue = 0x00;
DMA2D_InitStruct.DMA2D_OutputRed = 0x00;
DMA2D_InitStruct.DMA2D_OutputAlpha = 255;
DMA2D_InitStruct.DMA2D_OutputMemoryAdd =0xC0000000;
// ball 90*86
DMA2D_FG_InitStruct.DMA2D_FGO =0;
DMA2D_FG_InitStruct.DMA2D_FGMA =(uint32_t)_acSport;
DMA2D_FG_InitStruct.DMA2D_FGCM = CM_ARGB8888 ;
DMA2D_InitStruct.DMA2D_OutputOffset =800-90;
DMA2D_InitStruct.DMA2D_NumberOfLine = 86;
DMA2D_InitStruct.DMA2D_PixelPerLine = 90;
DMA2D_BG_InitStruct.DMA2D_BGO = 800-90 ;
DMA2D_BG_InitStruct.DMA2D_BGMA =0xC0000000 ;
DMA2D_BG_InitStruct.DMA2D_BGCM = CM_RGB565 ;
DMA2D_BG_InitStruct.DMA2D_BGPFC_ALPHA_MODE=REPLACE_ALPHA_VALUE ;
DMA2D_BG_InitStruct.DMA2D_BGPFC_ALPHA_VALUE = 255 ;
DMA2D_BG_InitStruct.DMA2D_BGC_BLUE = 0x00 ;
DMA2D_BG_InitStruct.DMA2D_BGC_GREEN = 0 ;
DMA2D_BG_InitStruct.DMA2D_BGC_RED = 0x00 ;
DMA2D_Init(&DMA2D_InitStruct);
DMA2D_FGConfig(&DMA2D_FG_InitStruct);
DMA2D_BGConfig(&DMA2D_BG_InitStruct);
// DMA2D_FGStart(ENABLE);
// DMA2D_BGStart(ENABLE);
DMA2D_Suspend(DISABLE);
/* Start Transfer */
DMA2D_StartTransfer();
/* Wait for CTC Flag activation */
while(DMA2D_GetFlagStatus(DMA2D_FLAG_TC) == RESET){}
LTDC_ReloadConfig(LTDC_IMReload);
2022-10-07 06:15 AM
Seems you miss how DMA2D works and how use it with LTDC .
And you dont show ltdc layer config...
Normal code is 8)
... on gui start and all initialized
ClearScreen(); // dont required here is in init
SHowImage(image1,x,y); // struct with info and data
...
DMA is used in ClearScreen and in SHowImage ....