2017-06-29 11:54 PM
Hi,
I am using the SMT32L476RG and my issue is relative to wake up the Uc from sleep mode through a USB plug interrupt.
I am currently used the USB_Device_Library from ST (v1.0_Cube)
Once I called MX_USB_DEVICE_DeInit(); and the Uc is running I am able to catch the interrupt plug connection trough void OTG_FS_IRQHandler(void). So everything is working pretty well.
Now when the Uc go to sleep mode I would like to wake up it through a plug to the USB port.
(By default it is does not work).
I tried (with so much other solution!) the following code that I put just before to go to sleep mode (without success) :
MX_USB_DEVICE_DeInit(); // Stop the driver in order to Get the PA9 (5V_OTG_VBUS) as a normal GPIO.
GPIO_InitStruct.Pin = GPIO_PIN_9;GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;GPIO_InitStruct.Pull = GPIO_NOPULL;GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_USB_OTG_FS_CLK_ENABLE();
HAL_NVIC_SetPriority(OTG_FS_IRQn, PRIOR_INT_USB, 0);HAL_NVIC_EnableIRQ(OTG_FS_IRQn);/* Also tried with EXTI9_5_IRQn even If at the end I have to use OTG_FS_IRQn and not EXTI9_5_IRQn
HAL_NVIC_SetPriority(EXTI9_5_IRQn, PRIOR_INT_USB, 0);
HAL_NVIC_EnableIRQ(EXTI9_5_IRQn);*/
I am stuck with this issue since two days and I tried pretty much all the ideas I had!I do not have any problem to wake-up the Uc from others external interrupt pins (such as PC1 , PC6, PC13)
Do you have any idea to make it work? Is this GPIO not working as any other external interrupt GPIO ? Any help would be greatly appreciated.
#usb-plug #stm32l4 #usb-wake-up #wakeup #sleep-mode