Safely switching on/off a USB device that is talking to your SoC - Page 1
Forum section: electronics / projects

author: somuchtyler
author_rank: Contributor
timestamp: April 25, 2021, 02:25:17 am
content: Hello, I feel that I have graduated the beginner section on this forum, so this is my first post to the general section.I have a SoC that has a USB connection D-/D+ to a downstream client USB device. I would like to save power by turning off the downstream device (and only turning it on when I need it). I do have a DC-to-DC converter that has an enable pin on it that I will be toggling for this to happen. I was wondering if anyone had problems doing this, because I worry about the fact that the downstream device will possibly putting a short on the data lines? Also is it ok for the data lines to be already connected to the host controller while the downstream device is being powered up? The reason I ask is every normal usb cable will have the pins for +/GND hit first before the data lines as you "plug it in". Will the downstream device be running into problems by having a device already connected to the data lines as it is being powered up?Any help would be appreciated...

author: NiHaoMike
author_rank: Super Contributor
timestamp: April 25, 2021, 02:53:33 am
content: Some USB hosts have the capability to switch off bus power, so in practice unlikely to be a problem.

author: Ian.M
author_rank: Super Contributor
timestamp: April 25, 2021, 03:35:04 am
content: IIRC the USB 2.0 standard calls for D+ & D- to be able to withstand an indefinite duration (>24H) short to Gnd or Vbus. Also your SOC host's D+ & D- wont be hard-shorted to Gnd, they'll be shorted via the CMOS parasitic diodes in the device which lowers the stress on them.However it would be advisable to disable the host's USB transceiver before powering down the device, which in most cases will tri-state the host's D+ & D- pins (check datasheets!), and to reenable it immediately after re-powering the device.

author: magic
author_rank: Super Contributor
timestamp: April 25, 2021, 06:46:51 am
content: The standard is thankfully available publicly so you can check it yourself.I would also check if this requirement also applies to a powered down client device (i.e. will it not get damaged by clamping the host's pullup current to ground). I think it should part of the requirements, but it's something I have never thought about and never paid attention to while reading the standard.Failing that, the device datasheet may provide information about allowable clamp current (likely more than will be sourced by the host) or transceiver shutdown is a solution too.

author: fordem
author_rank: Regular Contributor
timestamp: April 25, 2021, 11:21:24 pm
content: Think about this for a minute - USB hosts are connected to devices which are powered on & off on a daily basis with no concern for the status of the host device.Anybody using USB connected printers? Do you switch the printer on or off before the computer it's connected to? Have you ever attempted to print a document and found the printer off or even disconnected? Did you shut down the computer before connecting the printer or powering it on?Anybody using USB connected external storage devices? Maybe a USB/SATA dock? Do you switch the host computer off before swapping the drive in the dock? Do you remember to "eject" the diskeverytime before removing the drive?

author: SilverSolder
author_rank: Super Contributor
timestamp: April 26, 2021, 12:30:21 am
content: Quote from: fordem on April 25, 2021, 11:21:24 pmWindows was improved with removable devices, so unless you specifically tell it to cache writes on removable storage, it will write everything immediately.Meaning: you are probably OK to not use the "eject" feature if you haven't switched caching on! (edit: obviously, don't rip it out while you can see an application is writing to the drive or anything like that...)I switch caching on only when the SD card is deeply buried in a tablet or something, and won't be removed as a part of normal digital life...

author: fordem
author_rank: Regular Contributor
timestamp: April 27, 2021, 02:25:44 pm
content: You're missing my point - which was simply to remind people that they already power USB connected devices on & off everyday without a second thought - why start worrying about it now.