cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4 do not detect USB Suspend mode (LPM enabled)

Denis Krasutski
Associate III

I would like reduce power consumption from USB host when my device do not used by application on USB Host. I would like use STOP1 when device in suspend.

As I know USB Host should stop send SOF(when device is no active) and after 3ms device should detect idle bus event and enter to suspend mode or USB host can enter device to L1\L2 states(if LPM enable)

I have USB compocite device(USB HID+AudioInOut+CDC) on STM32L476 and I enabled LPM but my device do not receive Suspend(Device connected but no any data exchange)

I also tried example from:

STM32Cube_FW_L4_V1.17.0\Projects\32L476GDISCOVERY\Applications\USB_Device\HID_Standalone_LPM

I disable any data sending to host but also do not receive suspend event.

I am testing it on Windows10, Windows has enable:USB selective suspend.

Also I try it on Android and also do not get correct suspend behavior.

And one more point,my Windows10 has some device (I do not know who is it, it is part of my monitor) and seems this device in suspend mode and has no any BOS descriptor

0693W00000FCfFpQAL.pngBut example has the followinf state:

0693W00000FCfEsQAL.pngMy BOS descriptor:

0693W00000FCfO3QAL.pngMy questions: 

 - How OS(Windows or Android)host decide that device can enter in suspend mode?

 - Can I send device to suspend manualy by some system API (like ControlIO)

 - Type of USB Device Class can affect on suspend mode? Is it allowed for Composide devices?

 - Is it possible keep USB connection and use STOP1 mode after suspend received?

Thanks for any advice!

2 REPLIES 2
Denis Krasutski
Associate III

I forget mentioned, I use the following callbacks to detect suspend mode

/* -------------------------------------------------------------------------- */
 
void HAL_PCD_SuspendCallback(PCD_HandleTypeDef* hpcd) {
    /* Inform USB library that core enters in suspend Mode */
    USBD_LL_Suspend((USBD_HandleTypeDef*)hpcd->pData);
   
    LOG_DEBUG("USB Suspend");
}
 
/* -------------------------------------------------------------------------- */
 
void HAL_PCDEx_LPM_Callback(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg) {
    LOG_INFO("LPM state %d", msg);
}
 
/* -------------------------------------------------------------------------- */
 
void HAL_PCDEx_BCD_Callback(PCD_HandleTypeDef *hpcd, PCD_BCD_MsgTypeDef msg) {
    LOG_INFO("BCD state %d", msg);
}
 
/* -------------------------------------------------------------------------- */

is it right?

Denis Krasutski
Associate III

Try to up topic to get any help again)

Found description in STM32Cube_FW_L4_V1.17.0\Projects\32L476GDISCOVERY\Applications\USB_Device\HID_Standalone_LPM\readme.txt file :

You can test L1 suspend/resume, by running the USBCV3.0 chapter9 for USB2.0 devices 
and select (in debug mode) test "TD9.21: LPM L1 Suspend Resume Test".
Please note that for running USBCV3.0, you'll need a PC with a USB3.0 (xHCI)
host controller (please refer to USBCV3.0 documentation for more information).

By test tool I can receive L1 suspend and resume packets, but why Windows and Android hosts do not send it to my device?