cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 extra power consumption in STOP mode due to USB

Kuikui
Associate III
Posted on August 17, 2017 at 12:07

Hi,

I'm using USB with SPL on an STM32F4 system.

If I do this :

while(1)

{

   PWR_EnterUnderDriveSTOPMode(PWR_LowPowerRegulator_UnderDrive_ON, PWR_STOPEntry_WFI);

}

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);

while(1)

{

   PWR_EnterUnderDriveSTOPMode(PWR_LowPowerRegulator_UnderDrive_ON, PWR_STOPEntry_WFI);

}

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 ?

Thanks.

Best regards,

Vincent.

#stm32f4-usb-spl
2 REPLIES 2
Ben K
Senior III
Posted on August 18, 2017 at 19:42

What could be worth a try is to set the PCGCCTL register's STPPCLK (it can also appear as STOPCLK) bit during STOP mode (it supposedly stops the USB PHY clocking), although this is no more than an initial guess.

Kuikui
Associate III
Posted on August 20, 2017 at 14:51

I solved it by doing immediate register writes :

*((uint32_t*)0x50000038) = 0;

*((uint32_t*)0x5000000C) = 0x40001440; // Remove SRPCap

*((uint32_t*)0x5000000C) = 0x00001440; // Remove FDMOD

Nevertheless, this still doesn't explain the extra ~500µA power consumption if these bits are not cleared.