cancel
Showing results for 
Search instead for 
Did you mean: 

USB CDC and STOP2 power mode

jstefan
Associate
Posted on March 04, 2016 at 22:58

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    

 

1 REPLY 1
Walid FTITI_O
Senior II
Posted on March 10, 2016 at 17:59

Hi JanTM, 

Be sure that the exit from stop function is reconfiguring the System clock and it is providing the 48MHz to the USB peripheral.

Otherwise, can you provide more details like the following:

- What is the version of CubeMx that you have used ?

- What is the operating system of the PC ?

- The USB library that you are using ?

- Did you have taked USB trace when entering /leaving stop mode?

-Hannibal-