Wednesday 1 August 2012

My Raspberry Pi Setup

I was not amongst the first to order a Raspberry Pi so I received mine only last week. Here's a story of how I set it up and what issues I encountered on the way.

This is my setup. On top centre in the Pi itself. Upwards from it goes the HDMI connection to the screen and on its right side is connected an 8 GB MicroSDHC card in an SD adapter. Below the Pi is a powered el-cheapo USB hub, to which are connected the receiver for wireless keyboard and mouse and the WLAN dongle. The USB hub also powers the Raspberry Pi. On the lower right is a 5 V 3 A power source.

From the get-go I experienced issues with my setup: it was not stable, but corrupted the file system in really short order. Usually running the raspi-setup program, going through the settings and rebooting was enough to screw up the file system beyond all repair.

First I tried to solve this issue by trying out a couple different OS distros, using different methods of powering the system and using minimal amount of peripherals. I tried the official Raspbian "wheezy" image, the Raspbian Pisces image and OpenELEC. I could get none of them work to an useful degree.

Getting the power source in good shape was likely a notable part of getting the whole setup working. Originally I used a small adjustable power supply I had lying around. One issue was that the power supply heated up significantly when in use, even though it was rated for even more current than my setup consumed.

The other, maybe more major, issue was that the USB hub was powering the Pi from both the power input jack and the USB output jack. If I powered the Pi from a mobile phone charger and the USB hub from the adjustable power supply, unplugging the phone charger was not enough to power the Pi off. It has been reported that this can cause file system corruption, since while the electronics can be powered from the USB output jack, the 100 mA polyfuse in its power rails prevents the electronics from receiving enough power, causing the voltage to drop under recommended levels. This voltage drop can cause the SD card to behave erratically.

To prevent the USB hub from powering the Raspberry Pi through the USB output jack, I cracked the hub open and started to investigate.
Very simple device. Two-part plastic enclosure is held together only by tabs moulded to the bottom part. Inside is a one-sided circuit board with the USB connectors, one electrolytic capacitor, clock crystal, 3.3 V LDO regulator, unmarked microchip containing the USB hub logic and assorted resistors and small capacitors.

Here on the first picture you can see the modification I made to the hub: the USB connector to host computer is attached to the circuit board on top centre. The red and black leads of this connector, marked helpfully with letters R and B, were the leads that supplied the operating voltage from host to the board – or from board to the host. So, I cut them. Probably there was no need to cut the black lead and it would have sufficed to cut the red lead providing the +5 V connection and leave the 0 V black lead as-is, but I had already cut both leads when I realized this. Fortunately there's still the shield connection, which connects to the metal outsides of USB connectors and is likely tied to 0 V line anyhow. This modification makes this hub unusable as host-powered hub as the host can no longer power the hub or the devices connected to it, but I think I can live with that.
No modifications were done to the underside of the board. There's one interesting thing on the right side of the main IC, though. If you look closely, you can notice an seemingly out-of-place component connecting the right legs of C15 and R3. It might be a small capacitor. Anyhow it's in a somewhat odd angle and not connected to pads of its own, like all other components are. I can't make out, if it's a stray component that has happened to lodge itself there or if it's a cluge – maybe a component that needed to be added after a massive batch of circuit boards had already been manufactured.
Modifying the hub sorted out most of my power issues: now I could power the whole setup from one power source through the hub without accidentally powering the Pi through its USB outputs. The original power supply still got rather hot and I was somewhat suspicious of its capability to output stable 5 V, so I bought a small 5 V 3 A fixed-voltage switching mode power supply from Partco, a local electronic components supplier. This is plenty current capacity to drive the Pi and the peripherals I use. Nominally the Pi uses 700 mA, the WLAN adapter 500 mA and the keyboard and mouse receiver under 100 mA, so I have plenty of reserve power, should I want to connect an external hard disk drive or some such.

Even with the power issues solved, the file system corruption continued. Next up on the list was the SD card itself. On the left is a Transcend 4 GB Class 6 SDHC card I had been using in my old netbook to extend its fairly small SSD disks. Even though it had served me well on other uses, this card was totally unusable with the Pi. Major file system corruption and frustration ensued. When I switched to using the 8 GB Class 4 Kingston MicroSDHC and adapter on right, everything just started to work. No more file system corruption.


The markings on the back of the unusable card say "8281AB 4G 05D91" while the working card is marked "C08G" and "SDC4/8GB 56"

So, after a long wait for manufacturing and shipping, some hardware modification and changing memory cards I finally managed to get my Raspberry Pi in a working state. Right now it's nothing but a low-power silent device I can use to browse the web, but maybe I'll come up with some more interesting things to do with it soon.

No comments: