Go to control panel, to power options.
select power plan that you're using, then click "change plan settings"
then go to "CHange Advanced power settings"
go to "USB settings", then "USB selective suspend setting"
then select disabled on "plugged in" (and if you're on a laptop, also do it for "on battery")
Do these steps on other power plans if you change them often