cancel
Showing results for 
Search instead for 
Did you mean: 

Why no VSYNC coming out of STOP mode?

wired
Senior III

I'm trying to use STOP mode on my STM32F469I-DISCO evaluation board in a TouchGFX application. I call a function from the defaultTask that checks if the blue button is pressed, and if so, it enters STOP mode. I set up an event on the LCD_INT line from the touchscreen so that I can wake up when someone interacts with the screen. This all seems to work, but when I come out of Stop mode, the screen is no longer responding to touch. My STOP mode entry and exit code is shown below:

void checkStopMode()
{
 
	if (GPIO_PIN_SET == HAL_GPIO_ReadPin (BLUE_BTN_GPIO_Port, BLUE_BTN_Pin))
	{
		//Turn off display and backlight.
		HAL_DSI_ShortWrite(&hdsi, 0, DSI_DCS_SHORT_PKT_WRITE_P1, OTM8009A_CMD_DISPOFF, 0x00);
		HAL_DSI_ShortWrite(&hdsi, 0, DSI_DCS_SHORT_PKT_WRITE_P1, OTM8009A_CMD_WRCTRLD, 0x00);
 
		vTaskSuspend( TouchGFXTaskHandle ); // Suspend the TouchGFX task
		HAL_PWREx_EnableFlashPowerDown();
 
		__disable_irq(); //disable so that we don't end up in an ISR until we reconfigure the clocks after wakeup
 
	    // Clear the wakeup flag so we don't wake up right away
	    PWR->CR |= PWR_CR_CWUF;
	    HAL_PWR_EnterSTOPMode(PWR_MAINREGULATOR_ON, PWR_STOPENTRY_WFE);
 
		/********************   Return from Stop Mode ************************/
		/********   Wait for LCD_INT event from touch controller *************/
 
		SystemClock_Config(); /* Reconfigure the clocks */
 
		// Disable the powerdown of flash when entering Stop Mode.
		HAL_PWREx_DisableFlashPowerDown();
 
		__enable_irq(); // re-enable interrupts now that clocks are reconfigured
 
		vTaskResume( TouchGFXTaskHandle ); // Resume the TouchGFX task
 
	    // Turn on the display and backlight.
	    HAL_DSI_ShortWrite(&hdsi, 0, DSI_DCS_SHORT_PKT_WRITE_P1, OTM8009A_CMD_DISPON, 0x00);
	    HAL_DSI_ShortWrite(&hdsi, 0, DSI_DCS_SHORT_PKT_WRITE_P1, OTM8009A_CMD_WRCTRLD, 0x2C);
	}
 
}

I've tried all kinds of different function calls through trial and error, but nothing works. I have a breakpoint right when I come out of STOP mode, and then I set another one in the for loop below at OSWrappers::waitForVSync().

void TouchGFXHAL::taskEntry()
{
    enableLCDControllerInterrupt();
    enableInterrupts();
 
    OSWrappers::waitForVSync();
    backPorchExited();
 
    /* Enable the LCD, Send Display on DCS command to display */
    HAL_DSI_ShortWrite(&hdsi, LCD_OTM8009A_ID, DSI_DCS_SHORT_PKT_WRITE_P1, OTM8009A_CMD_DISPON, 0x00);
 
    for (;;)
    {
        OSWrappers::waitForVSync();
        backPorchExited();
    }
}

It breaks there once when I resume from the breakpoint at SystemClock_Config(), but never gets out of the function. Can anyone tell me what I'm missing in my wakeup code? Been trying to get this working for most of a day now...

Also, I should mention that the defaultTask continues to run normally after wakeup.

10 REPLIES 10
wired
Senior III

Started messing with the DISCO board again, trying to find out where those 18mA on 3V3 are coming from.

Part of it is from the LD1117 LDOs, which can have from 5-10mA quiescent current each. I tried lifting the Vin pin on both U7, which generates 3V3 from +5V (I am directly feeding 3V3 in on CN6 and have removed SB8), and U8, which generates the 1.8V for the CS43L22. Interestingly, U7 made no difference, but U8 did. However, if you want to remove the quiescent current produced by U8, you will need to also remove the Cirrus CS43L22 at U5. If you power up U5 with 3V3 but not U8, it apparently draws excessive current ( I went from 90mA to anywhere between 120 and 160 mA). Temporarily making the connection at pin 3 restored the normal current, and then when I entered STOP mode my 3V3 current dropped to ~10mA. I did not feel like removing U5, so I reconnected pin 3 of U8 - at least I know now where some of that current was being drawn.

I also tried issuing a powerdown command to the SDRAM prior to entering STOP mode. as shown below:

// Place the SDRAM in powerdown mode.  It will exit powerdown mode on the next read/write operation.
   FMC_SDRAM_CommandTypeDef Command;
   Command.CommandMode   = FMC_SDRAM_CMD_POWERDOWN_MODE;
   Command.CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1;
   Command.AutoRefreshNumber      = 8;
   Command.ModeRegisterDefinition = 0;
   // If controller is busy, it will return SDRAM_ERROR, so keep trying until it is not busy.
   while (SDRAM_OK != BSP_SDRAM_Sendcmd(&Command));

That did not make as much difference as I expected (only a few mA). However, it is a needed component of power reduction if you are trying to minimize STOP mode current.