I'm using USB with SPL on an STM32F4 system.
If I do this :
Then my system power consumption is 1.6mA.
But if I do this :
USBD_Init(&USB_OTG_dev,USB_OTG_FS_CORE_ID,&USR_desc, &USBD_CUSTOMHID_cb, &USR_cb);
Then my system power consumption is 2.4mA.
It clearly appears that the USB initialisation increases power consumption in STOP mode.
I've noticed that this extra power consumption is due to "GCCFG->PWDRWN" bit and USBCFG->FDMOD and SRPCAP bits.
After a USB initialisation, if I reset these bits to 0 thanks to the debugger, then I got back my 1.6mA in STOP mode.
But I'm not able to reset these bits programmatically.
USB_OTG_WRITE_REG32 (USB_OTG_dev.regs.GREGS->GUSBCFG, 0x00001440); <= does nothing (the value 0x00001440 is the same value as when I reset the SRPCAP and FDMOD bits manually with the debugger).
Any clue how to properly reset the USB to its default reset state ?
Any reason of this extra power consumption in STOP mode ?