AnsweredAssumed Answered

USB CDC and STOP2 power mode

Question asked by JanTM on Mar 4, 2016
Latest reply on Mar 10, 2016 by FTITI.Walid
I am using a STM32L476 chip based on  CubeMX generated code .

I have ported this to a development board and implemented Stop2 power state to save battery life.

I have a stop_x() and start_x() function for each device x that I use. They disable the device while in Stop2 mode and restore it for use on exiting Stop2. 

I recently added USB CDC middleware to allow messaging with a PC. I have no real experience with USB and the middleware code.

Currently, if I never enter Stop2 mode, the USB CDC functionality works.

When I do use Stop2 mode, later, when we are running, the USB CDC will not ACK the initial Host message and fails to connect. 

I do understand that, while connected to a USB host, that I should not enter Stop2 mode. There is really no need to conserve battery if powered by the USB. 

I need to be able to continue using Stop2 after the host connection terminates.  

How can I write stop_usb() and start_usb() functions that allow the USB to continue to work after we exit from Stop2 mode?

I have tried:
         1. Holding the USB in reset while in Stop2
         2. Calling USBD_Stop() and USBD_Start()
         3. Calling USBD_DeInit() and USBD_Init()

None of the above methods has allowed the USB to survive the Stop2 state and connect with a host afterwards.

Any ideas or examples would be appreciated.

Thanks in advance,
Jan    
 

Outcomes