2014-02-11 07:06 PM
Hi,
I noticed after USBD_Init(); function has been called, it has increased the current consumption of the MCU. While entering sleep mode, the amount of current consumption caused by USB init is unable to be removed.By referring to Power Option in USB on-the-go full-speed (OTG_FS) chapter, the power is controlled by these three bits:1)PHY power down (GCCFG/PWRDWN)2)A-VBUS sensing enable (GCCFG/VBUSASEN)3)B-VBUS sensing enable (GCCFG/VBUSASEN)Therefore I do a function to clear these three bits after USB being removed and before MCU enter sleep but this action causes the PA9 which is USB detection pin to immediately go high even though there is no USB connection.Do we allow to manually clear these bits? Is there any suggested method to de-init or shut down the USB properly?Thanks.Best regards,Shirley2014-02-12 01:36 AM
Hi
I have not done this work yet on the project I am on, so I may not be able to give you the answer you are looking for. ''I noticed after USBD_Init(); function has been called, it has increased the current consumption of the MCU.'' Yes, this will have enabled the 48MHz clock to the USB peripheral core. ''By referring to Power Option in USB on-the-go full-speed (OTG_FS) chapter'' Please refer to section ''Power controller (PWR)'' in conjucntion with the USB periapheral section you mentioned. ''Therefore I do a function to clear these three bits after USB being removed and before MCU enter sleep but this action causes the PA9 which is USB detection pin to immediately go high even though there is no USB connection.'' I suspect that there is more than software required to get this to work - the electronic design must be correct to get this to work. It is complicated by USB OTG (On The Go) - this allows dynamic switching between host and device. This involves a pull up on one side (I am not sure which). This pull up may be the thing that is triggering the USB detection. I can only suggest looking at the schematics for the different reference designs from ST (or another manufacturer) Finally, to get the full USB power saving, as part of the sleep mode - it is a good idea to put the USB core into 'USB system stop' by 'clock gating'. This is detailed in the USB peripheral section and the ''Power controller (PWR)'' section.