cancel
Showing results for 
Search instead for 
Did you mean: 

USB-Device_Only - STOP_Mode - Not Wakeup

MMARI.1
Senior

hi ,

Working on USB - Device_Only  wake up from Stop mode and entering to stop mode is successful but not wakeup from stop mode .There is no  example code for USB wake up from STOP Mode .

Entered to stop with following code :

 HAL_SuspendTick();
 HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);

Trying to wake from stm32f4xx_it.c with following code :

void OTG_FS_WKUP_IRQHandler(void)
{
  /* USER CODE BEGIN OTG_FS_WKUP_IRQn 0 */

  /* USER CODE END OTG_FS_WKUP_IRQn 0 */
  if ((&hpcd_USB_OTG_FS)->Init.low_power_enable) {
    /* Reset SLEEPDEEP bit of Cortex System Control Register */
    SCB->SCR &= (uint32_t)~((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk));
    SystemClock_Config();
  }
  __HAL_PCD_UNGATE_PHYCLOCK(&hpcd_USB_OTG_FS);
  /* Clear EXTI pending bit */
  __HAL_USB_OTG_FS_WAKEUP_EXTI_CLEAR_FLAG();
  /* USER CODE BEGIN OTG_FS_WKUP_IRQn 1 */
  HAL_ResumeTick();

  /* USER CODE END OTG_FS_WKUP_IRQn 1 */
}

 D+ pin is 3.3v at stop mode . There is anything i need to do before entering to STOP mode usb

2 REPLIES 2
FBL
ST Employee

Hi @MMARI.1 

 

Which STM32F4 product are you using? You may need to refer to RM for full description of Low power sequence. Here is an example to wake-up from STOP mode using FS controller.

If using ULPI interface for HS operations, you can enter stop mode and read/write using ULPI registers. Refer to PHY datasheet for ULPI register map section 7. You can check this example for ULPI interface on F7. Then to exit low power mode according to ULPI datasheet, you may need to enable GPIO clock for OTG USB STP pin then set OTG STP pin as GP Output finally set OTG STP pin to High state during 4 milliseconds.

I hope this helps!

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


I'm out of offce with limited access to my emails.
Happy New Year!

hi,

i was used stm32f446re . 

Using ULPI interface for HS operations on STOP Mode will be solution  .

 ( not USB related )Currently working on stm32f722ze and  going  to add stm32h7b0 

power saving is essential  in any series . Hope  your suggestion will be for all series .