Menu

Jan 22, 2013

Raspberry Pi mod to avoid reset / shutdown on USB hot-plug

A few days ago the Raspberry Pi arrived and we got our hands on it to test what it is capable of. If you want to know how we solved the USB hot-plug reset / shutdown issue just keep reading! 

First of all, the cost of the "B" board and an enclosure, with tax and delivery is almost twice as much as the $25 advertised by RPi Foundation. But of course I guess you could buy and pick up the "A" board in some physical place (could you?) and build your own case for it (you could!). As power adaptor, USB hubs, cables and peripherals are not included in the claimed price, and we had some, it is cheap enough for what you get (you could compare it, for example, with an Arduino's power/cost; but then, that is another kind of device).

The bill

The first thing we noticed is that the raspbian image / SD card / board was wery prone to have data corruption, and it took three attempts to get the image finally booting up sound. Later, after some more image breaks due to the USB hot-plug issue, we noticed the most stable configuration was to choose the medium overclock option of the board in the rasp-config utility menu. This sets some parameters in the /boot/config.txt file, including over_voltage=2, mentioned to work best by other users.

 
The second thing we really didn't know is that, as happened with the Pandaboard's PowerVR GPU, and other so called "open hardware" boards, RPi's GPU is not open at all, which from our personal point of view is quite disappointing, specially when you get to know that the Opengl ES capabilities are very limited (you can't have regular OpenGL ES in a X window!).
There is an interesting post here discussing about if an educational board should prioritize price or openness. And some more open alternatives.
  
Then at last the USB hot-plug issue came by. Although we are using an old Apple keyboard with it's embedded USB hub to plug a mouse, it cant provide enough current to an USB pendrive. So we unplugged the wifi dongle from the second RPi port to pug the pendrive and oooops! It instantly rebooted. It was obvious that this was a power issue, more so knowing the limitations of the 0.7A cell phone power supply we were using (which measured 5.10v).


Seeking in the Internet confirmed our guess, and we learned the whole story about the design decisions that lead the board to behave this way.
Forum users tests and research suggested to put a small resistor in parallel to each of the F1 & F2 fuses of the board, if yours had them. But our recent R2 revision (maked revision 1244 on the bottom of the board) lacked those fuses, and there was no access to the former pins. So we followed the suggestions pointed out in the blog http://theiopage.blogspot.com.es, an decided to take the risk and solder two capacitors to the board without any previous test.
One 1000uF electrolytic capacitor (rated at least 6v) would substitute C6 next to the microusb power connector, increasing the capacity.



The other one would be soldered in parallel to C32, and should be a "low ESR" one, 100uF or more (also rated at least 6v), so the resulting resistance would be lower and the total capacity will match the USB design specs (150uF). 


Now, after modding the board, we are able to hot-plug/unplug a wifi dongle or a pendrive, as long as it does not drain the current needed by the rest of the devices (we tried an old high-power wifi dongle and it made the reset happen again).


[Edit] There is another Polyfuse marked F3 at the bottom of the board, which also lowers the voltage due to its high resistance. See this thread for more info: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=26&t=22318
 

8 comments:

  1. Thanks for the explanation.
    As a result of your post I did my similar mod which can be found here: http://thestuffsido.blogspot.com/2013/05/fixing-raspberry-pi-hotplugging.html

    ReplyDelete
  2. Hi, i can ask you if i can use a 1500uf 16v for the first and 220uf 10v for the second? Thanks

    ReplyDelete
    Replies
    1. Sure, as long as their voltage rate is 10v or above you are safe.

      Delete
  3. Sigh I am not sure if these comments are being moderated but everytime i click publish it doesn't do anything.. trying AGAIN.

    Could the C32 just be replaced with a larger Capacitor instead of adding one in parallel for ease of soldering?

    Thanks,
    James

    ReplyDelete
  4. Hi I soldered a 25V 470uf capacitor on C32 (parallel) but the RasPi continues to reboot when I insert my 2.5" Hard Drive. I'm using a 5V - 2A power supply. Am I missing something? Rev is 1245

    ReplyDelete
    Replies
    1. Hi,
      The hard drive is probably producing a spike current that drops the voltage down to levels below the minimum required by the RPi to work. I guess you will have to use an USB "Y" cable and feed the hard drive directly from the power supply, making sure it is powered up before starting the RPi.

      Delete