AnsweredAssumed Answered

STM32F4 and 1024x600 display refresh problem

Question asked by snufus on Jun 30, 2015
Latest reply on Jul 7, 2015 by snufus
Hello,
I'm using stemwin 5.26 on STM32F429IIT6 using LCD controller and freertos. my display is 1024 x 600. I started to implement some simple windows, but I see that refresh of the window causes a visible frame corruption. I made and attached a small video to explain clearly the issue.
I saw that using only on later (GUI_NUM_LAYERS 1) seems to cancel the issue. I cannot focus if the problem is in the ltdc configuration, dma2d config or STemWin libs.

Here code snippets of what I have in the program.
main()
{  
  /*** [.....] ****/
  /* Initialize GUI */
  GUI_Init();
  
  osThreadDef(defaultTask, StartDefaultTask, osPriorityNormal, 0, 128);
  defaultTaskHandle = osThreadCreate(osThread(defaultTask), NULL);
  
  osThreadDef(GUI_Thread, GUIThread, osPriorityLow, 0, 20 * configMINIMAL_STACK_SIZE);
  osThreadCreate(osThread(GUI_Thread), NULL); 
  
  /* Start scheduler */
  osKernelStart();

/**************************************************************************************/
  static void GUIThread(void const * argument)
    { 
    GUI_SelectLayer(1);    
    GUI_SetColor (GUI_YELLOW);
    GUI_FillRect(600,300,1024,600);
    GUI_SetColor (GUI_BLUE);
    GUI_FillRect(20,10,500,500);
    
    k_InitMenu(); 
    
    while(1) 
        {
        LED_Toggle(LED1);
        LED_Toggle(LED2);


        GUI_Delay(100);
        }
    }
    
/**************************************************************************************/
void k_InitMenu(void) 
{
  WM_SetCallback(WM_HBKWIN, _cbBk);
  
  GUI_SelectLayer(1);
  WM_CreateWindowAsChild(0, 0, 1000, 25, WM_HBKWIN, WM_CF_SHOW | WM_CF_HASTRANS | WM_CF_MEMDEV, _cbStatus, 0);
}
    
/*******************************************************************************
  * @brief  Callback routine of desktop window status.
  * @param  pMsg: pointer to data structure of type WM_MESSAGE
  * @retval None
  */
static void _cbStatus(WM_MESSAGE * pMsg) 
    {
    int xSize, ySize;
    static uint8_t TempStr[50];
    static WM_HTIMER hTimerTime;
    static uint8_t tmp;
    static uint8_t bmp_res2;


    RTC_TimeTypeDef   RTC_Time;
    RTC_DateTypeDef   RTC_DateStructure;
    uint8_t sec, min, hour, day, month;
    uint16_t year;
    WM_HWIN hWin;


    hWin = pMsg->hWin;
    switch (pMsg->MsgId) 
        {
        case WM_CREATE:
        hTimerTime = WM_CreateTimer(hWin, ID_TIMER_TIME, 1000, 0);
        break;


        case WM_DELETE:
        WM_DeleteTimer(hTimerTime);
        break;


        case WM_TIMER:
        if( WM_GetTimerId(pMsg->Data.v) == ID_TIMER_TIME)
            {
            WM_InvalidateWindow(pMsg->hWin);
            WM_RestartTimer(pMsg->Data.v, 1000);
            }
        break;


        case WM_PAINT:
        xSize = WM_GetWindowSizeX(hWin);
        ySize = WM_GetWindowSizeY(hWin);


        /* Draw background */
        GUI_Clear();
        
        GUI_SetColor(0x008d00);
        GUI_FillRect(0, 0, xSize , ySize - 3);
        GUI_SetColor(0x808080);
        GUI_DrawHLine(ySize - 2, 0, xSize );
        GUI_SetColor(0x404040);
        GUI_DrawHLine(ySize - 1, 0, xSize );


        /* Draw time & Date */
        GUI_SetTextMode(GUI_TM_TRANS);
        GUI_SetColor(GUI_WHITE);
        GUI_SetFont(GUI_FONT_13B_ASCII);


        k_GetTime(&RTC_Time);
        sec    =  RTC_Time.Seconds;
        min    =  RTC_Time.Minutes;
        hour   =  RTC_Time.Hours;


        k_GetDate(&RTC_DateStructure);


        sprintf((char *)TempStr, "%02d:%02d:%02d", hour , min, sec);
        GUI_DispStringAt((char *)TempStr, xSize - 70, 4);


        year =  RTC_DateStructure.Year + 2014;
        month =  RTC_DateStructure.Month;
        day =  RTC_DateStructure.Date;


        if((day > 0) && (day <= 31) && (month > 0)&& (month <= 12) && (year >= 1900))
            {sprintf((char *)TempStr, "%02d, %s, %04d", day , strMonth[month-1], year);}
        else
            {sprintf((char *)TempStr, "01, January, 2014");}


        GUI_DispStringHCenterAt((char *)TempStr, xSize / 2, 4);


        GUI_DispStringAt( (char *)TempStr, 50, 4);
        break;


        default:
        WM_DefaultProc(pMsg);
        break;
        }
    }

Attachments

Outcomes