cancel
Showing results for 
Search instead for 
Did you mean: 

How to reduce power consumption while connected via CDC USB

antfarmer
Associate III

I'm developing a board with an STM32L452 and would like to find out if I can improve power consumption while it remains connected via USB (as a device). I've tried putting the device to sleep using the following code:

 

while (1) {
	// ... do stuff
	HAL_SuspendTick();
	HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFI);
	HAL_ResumeTick();
}

 

My configuration for USB is CDC and has SOF, Low power, and Link power management enabled. I've tried changing these settings, but none of these seem to make a difference.

 

The issue is the USB IRQ keeps the device from staying in sleep mode, so there's very little difference in power usage overall. I would like to keep the USB connection, otherwise the host pc software would have to poll and try reconnecting constantly. I know the host can tell the device to suspend, but is there a way the USB device can tell the host to pause and continue if either the host or device have something to communicate? Sort of like SDMMC can do with clock power saving mode.

10 REPLIES 10

In a sense, yes, however I'm using the built-in Linux drivers which creates ACM connections for CDC devices. I don't think it's worth it for me to customize something like that for Linux, and for my case it would be better for the device to request the suspend as you wrote earlier from the spec. Pardon my ignorance here, but what is this AI you speak of?