I have a USB powered board, that should consume as little power when idle as possible, while keeping the USB connection alive.

The device only sends data to the host, doesn't receive any, so the connection itself doesn't necessarily have to be working while idle, but the host needs to be able to see the device as connected. So the device should never disconnect.

I can set the Atmega32u4 to idle mode while keeping the USB connection up, but the power consumption is really high (hardly lower than when active). I disabled all the peripherals I can disable in idle mode, but it didn't change much.

As soon as I enter any other sleep mode (power down, stand-by or ADC noise reduction) the connection is lost and the host can't see the device any more, even though the documentation says, that in ADC noise reduction mode, the USB clock stays active, and in power down/stand by, asynchronous USB interrupts should keep working.

Is there anything else I can do to reduce power consumption?

Is there anything I need to do to use power down, stand-by or ADC noise reduction modes while keeping the USB connection alive?

  • How do you put the MCU into sleep mode? Isn't it waked after a millisecond or so by the timer interrupt? Commented Nov 23, 2022 at 12:43
  • I am currently using this library: github.com/LowPowerLab/LowPower . I figured out, that I made a mistake, and now I can use ADC noise reduction mode. But the change isn't very high. If I drop it down using power-down/standby, the power consumption is reduced to next-to-nothing, but the USB connection is lost. It is woken by the WDT, afaik, and I let it wake up after 256ms. It is than awake for <1ms before sleeping again.
    – Dakkaron
    Commented Nov 23, 2022 at 14:24
  • Is there a way to put it into power-down/standby without loosing the USB connection? That would be perfect.
    – Dakkaron
    Commented Nov 23, 2022 at 14:25
  • Are you calling idle() with ADC_OFF, TIMER4_OFF... and everything else OFF? Try measuring the current draw with both USB_OFF and USB_ON: this will tell you whether it's the USB peripheral itself that is drawing too much current. You can also check the datasheet to see if there are other peripherals not taken care of by the library, which you could disable with the power_*_disable() function from the avr-libc. Commented Nov 23, 2022 at 16:12
  • @EdgarBonet Very interesting: USB_OFF reduces the power consumption significantly (even lower than ADC noise reduction mode), while keeping USB alive. I am still well above the current usage that I get in powerdown mode, but that's a significant improvement already. This leads me to think that powerdown should be possible, but that I need to somehow need to add interrupts or something for USB to correctly react to SUSPI/WAKEUPI while in powerdown mode.
    – Dakkaron
    Commented Nov 24, 2022 at 8:51


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.