cancel
Showing results for 
Search instead for 
Did you mean: 

LTDC Reset after Stop Mode

MStud.4
Associate

Hey

We are trying since a few days to reset our Display after Stop Mode, without much success. We are using a STM32F767IIT6 and a 480x272 Display, which is driven over the LTDC. Our code is appended.

When the power button is pressed, we set a flag. We check the flag in the FreeRTOS idle hook. This because we experienced that we cannot wake up from de Stop Mode in an usual task.

The Stopmode works, but after wakeup, the display is white, no elements are drawn. With debugging we found that after the reset of the LTDC, the tick of the TouchGFX model doesn't get called anymore. The same thing happens if we comment the enterstopmode line out.

We found that if we do not set the LTDC reset bit, the TouchGFX model tick function does get called. But if we do not set the LTDC reset bit, our screen shows only a noise pattern after the Stopmode.

How do I correctly reset the LTDC? How do I use the LTDC correct in combination with Stopmode? How is the LTDC bit correctly used?

Thanky you in advance!

void vApplicationIdleHook( void ){
	if (gotosleep){
		__HAL_GPIO_EXTI_CLEAR_IT(KEY_OnOff_Pin);
		
		osThreadSuspend(defaultTaskHandle);
	    HAL_GPIO_WritePin(D_BL_CTRL_GPIO_Port, D_BL_CTRL_Pin, GPIO_PIN_RESET); //Turn Backlight off
	    HAL_GPIO_WritePin(LTDC_DOFF_GPIO_Port, LTDC_DOFF_Pin, GPIO_PIN_RESET); // Display OFF
 
	    HAL_LTDC_DeInit(&hltdc);
		HAL_SuspendTick();
 
		//Set Pin for Wakeup Interrupt
		GPIO_InitTypeDef GPIO_InitStruct;
		GPIO_InitStruct.Pin = KEY_OnOff_Pin;
		GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
		GPIO_InitStruct.Pull = GPIO_NOPULL;
		HAL_GPIO_DeInit(KEY_OnOff_GPIO_Port, KEY_OnOff_Pin);
		__HAL_RCC_GPIOA_CLK_ENABLE();
		HAL_GPIO_Init(KEY_OnOff_GPIO_Port, &GPIO_InitStruct);
 
 
		HAL_PWR_EnterSTOPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFI);
 
		HAL_Init();
	    HAL_ResumeTick();
 
	    SystemClock_Config();
 
	    RCC->APB2RSTR |= 1UL << RCC_APB2RSTR_LTDCRST_Pos; //Set LTDC Reset Bit
	    MX_LTDC_Init();
	    RCC->APB2RSTR &= ~RCC_APB2RSTR_LTDCRST_Msk; //Reset LTDC Reset Bit
 
	    HAL_GPIO_WritePin(D_BL_CTRL_GPIO_Port, D_BL_CTRL_Pin, GPIO_PIN_SET);
	    HAL_GPIO_WritePin(LTDC_DOFF_GPIO_Port, LTDC_DOFF_Pin, GPIO_PIN_SET); // Display ON
 
	    osThreadDef(defaultTask, StartDefaultTask, osPriorityNormal, 0, 4096);
	    defaultTaskHandle = osThreadCreate(osThread(defaultTask), NULL);
		
		MX_TouchGFX_Init();
		
		//Turn Display On
		HAL_GPIO_WritePin(LED_PShot_GPIO_Port, LED_PShot_Pin, GPIO_PIN_RESET);
		HAL_GPIO_DeInit(KEY_OnOff_GPIO_Port, KEY_OnOff_Pin);
 
		gotosleep = 0; //Reset Flag
	}
}

0 REPLIES 0