Hard Reset of USB Devices

Is there a way to give a hard reset to a USB device by powering it down via software? Every time I crash my target I have to go into the other room and unplug the cable. Not only is it a PITA to do that, but those connectors aren't rated for a bazillion operations. I've had surface mount connectors come off the board from being plugged in too many times.

I have done some digging and found a lot of reference to resetting USB devices, but they all have to do with disabling the device or the port it is connected to. I haven't seen anything about cutting power. Is that possible on a USB port?

--

Rick
Reply to
rickman
Loading thread data ...

I also asked for this in this group, but didn't receive an answer.

sudo reboot # Works for me, but I would rather just reset USB.

Reply to
M.O.B. i L.

I have seen that not work for me. The target processor can be hung to the point of requiring power to be removed or at least a hardware reset. The board has a button on it and the second processor which can act as a debugger can assert reset to the target processor. But that requires the TI tools which I'm not sure work ok under Linux.

If power can be cycled on the USB port, that would solve the problem in a very portable way, working for any target board which gets power from the USB bus.

--

Rick
Reply to
rickman

It is possible, on the B+ and Pi2, to turn off the power to *all* of the USB ports and turn it on again afterwards. It will also turn off the Ethernet port, as that runs from USB too.

There's an explanation on the Raspberry Pi forums on how to do this.

Otherwise you might have some success with unloading and reloading the driver using (sudo) modprobe -r drivername and then (sudo) modprobe drivername

Reply to
Dom

Doesn't disabling it cut power? Try to just disable/enable (in a script, with a sleep in between, because Ethernet hangs off the USB too).

Reply to
Rob Morley

Not in general. There may be board-specific things you can do with GPIOs or sending commands to the PMIC, but there's no USB-protocol way to do that. So it's specific to a particular platform (eg Raspberry Pi in this case) but you can't easily port it to another board (unless there's a Linux API for that, which I'm not aware of).

Theo

Reply to
Theo Markettos

Thanks for the info. I had not found that yet. Unfortunately my pi is an older Model B. But the code says it can also work on some hubs. So that may work for me yet.

--

Rick
Reply to
rickman

Not to my knowledge. Laptops usually use some kind of proprietary bus to manage power on USB devices, Toshiba's "HCI" comes to mind as I've cursed it a lot. Basically I couldn't use a built-in 3G modem in a Toshiba laptop from Linux because it had no power to its radio part. Until someone hacked together something to control that and a few other things too. The laptop's bluetooth could be switched off so completely that it disappeared from the USB bus so presumably powered off.

I guess you could control the +5V line to your balky device with a GPIO pin from the rPI and minimal HW?

Reply to
Anssi Saari

The problem with USB is there is no reset or anything - just two power and two data lines.

If it fails to respond to data, there is only one thing to do - power it off and replace the part with something more reliable.

--
Everything you read in newspapers is absolutely true, except for the  
rare story of which you happen to have first-hand knowledge. ? Erwin Knoll
Reply to
The Natural Philosopher

What cable needs to be unplugged? Is the device self-powered or is it bus-powered? Does unplugging the USB-cable cause a hard reset of the device? Does unplugging the power-cable cause a hard reset of the device?

In case the device in question is bus-powered so that there probably is a self-powered USB-hub betweeen the device and the raspberry pi also delivering the power for the device in question:

How about attaching an USB-hub to the Raspberry Pi which is not bus-powered but self-powered whereby the power of that USB-hub can also be switched on and off via relais while the relais in turn is controlled via the Raspberry Pi's GPIO-interface?

Ulrich

Reply to
Ulrich D i e z

Unplugging the target MCU removes power. I was forgetting the "reset" button on the target board so I can use that... if I walk from one room to the next. Ultimately I'd like to have this remote as in over the Internet so a software driven reset would be essential.

Yes on both counts although I initially tried plugging the target directly to the rPi thinking an rPi reset would cycle power on the target... didn't work. USB power on the Model B is hard wired. B+ and rPi 2 seem to go through some type of switch although there are no schematics which show this. I have found code which will control power through some USB hubs and the rPi 2, B+. I'm looking at buying one of the hubs with power control.

Not sure where to find all that. I found info on controlling USB power which works on some better built hubs. D-link has one I can get for $20 or so compared to the $7 I paid for my current hub with a power pack that doesn't regulate at all! I complained to the eBay vendor and they didn't even respond, just a refund... lol

--

Rick
Reply to
rickman

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.