Original URL: http://www.theregister.co.uk/2011/11/28/raspberry_pi/
Psst, kid... Wanna learn how to hack?
The £25 computer to teach youngsters real computing skills
Analysis Despite all the excitement and expectation encompassing the RaspberryPi, the most remarkable thing about this low-power credit card-sized computer is its price tag: little more than £20 for a fully functional system capable of, among many things, 1080p video playback and hardware-accelerated graphics.
The British-designed Pi is being heralded as the saviour of modern IT education in UK classrooms, one that will raise a new generation of young bedroom hackers - in the old sense of the word 'hacking', that is, to ingeniously cobble stuff together to make cool new things.
The UK needs to pull its socks up to equip youngsters with the skills they need to survive in a world that is thoroughly hooked on web-connected technologies and yet poorly inoculated against digital disease. The RaspberryPi's engineers want to give kids some cheap and educational kit that won't break or turn into a nightmare to maintain.
But, putting politics aside for a moment, what really grabs your attention is how small and cheap the damn thing is. How this feat of engineering is possible is easy to answer, though: creating a computer that's deliberately priced to be as affordable as a school textbook is all about having the right connections - and we don't just mean the wiring on a PCB.
The Pi is powered by a 700MHz ARM-compatible processor with hardware support for OpenGL ES 2.0 and Blu-ray-grade playback (1080p30 H.264), and features 256MB of RAM, TV, HDMI and audio outputs, a USB port, a Flash memory card slot, 100MBit Ethernet and a number of I/O pins for a serial port and general purpose hacking. This is all fitted on a low-cost 85.60mm x 53.98mm board that's about 20mm high, weighs 40g and is powered from a 5V supply.
No, you haven't clicked through to an El Reg story from mid-2000. Remember, this is a tiny bit of kit aimed at getting hackable technology into the hands of anyone who can afford $35 (£22), and, er, a telly and assorted peripherals. However, parents won't have to worry about the home PC getting wrecked by their teenagers' handmade software, cash-strapped school labs could be kitted out for less than £1,000, and kids can begin to toy with a system that draws a single watt and is easier to develop tightly written software on than today's nightmare of software frameworks and compilers.
It's also a handy price tag for geeks and hackers, especially those tempted by the recent rash of announcements from the ARM scene, who have been put off by the reassuringly expensive price tags and the lack of availability of development boards to date. The pre-production RaspberryPi is in the hands of about 50 beta testers at the moment, and the first production run of 10,000 units is expected to go on sale in December.
So how do you make something so small and cheap?
First of all, the RaspberryPi's processor is really designed for mobile products: it's a gaming and multimedia graphics chip - the Broadcom BCM2835 - with an ARM1176JZF-S core and floating-point maths unit bolted inside for good measure.
The GPU, Broadcom's Videocore IV, has capabilities equivalent to a first-gen Xbox, and has its own proprietary instruction set and architecture that is closely guarded by Broadcom; the compiler for it is not available. But the ARM side is a standard v6 core that is well supported by GCC, ARM GNU/Linux and various other open and closed source developers.
Therefore you get high-end mobile graphics capabilities, and a general purpose processor thrown in for free, inside a small system-on-a-chip package that doesn't need any cooling, even after eight hours of HD video playback, which can play Quake 3 in 1920x1080. Soldered directly on top of the processor package is the RAM, which along with the lack of a cooling fan saves an immense amount of space and some cost.
Next, there's no onboard battery-backed clock, which is used to maintain a real-time record of the time and date when the board is switched off. On the Pi, the operating system must grab these settings from the web or network (using NTP) or get the user to type them in after power-on.
The USB and Ethernet hardware is packed into one chip, the SMSC LAN9512; there are no other clunky buses present that are found on larger motherboards, no PCIe or SATA IDE for example to take up space.
The SD card slot can be found underneath this pre-production RaspberryPi board
There's no onboard chunky flash memory: when the board is powered up, the GPU starts executing instructions from a small boot ROM that locates the GPU's firmware and a kernel for the ARM core in a FAT16 or FAT32 partition on the memory card or USB drive plugged into the Pi. Once the firmware and kernel are running, the operating system can be booted from the memory card, USB drive or over the network.
The reliance on removable boot memory also ensures the kit can't be bricked, not even by the most inquisitive or vindictive schoolchildren.
There's also no Wi-Fi chipset, although you're welcome to try a USB or Ethernet-connected adapter to get your Pi hooked up to your wireless network (or wait for Wi-Fi functionality to be added, maybe). The Pi's engineers have also placed connectors wherever it suits their design: you get a compact and cheaper six-layer PCB (or possibly four-layer in future), but it resembles a mad electronic spider with all sorts of cables spiralling out from it. Not all the I/O lines are taken from the processor; some are located near the centre of the chip package and extending those out to a user-accessible header would cost too much.
Productivity on the cheap
The Pi team has spent months and months hunting for components that meet the right balance of size, cost and quality: go too small and the price can end up soaring, go too big and the PCB suddenly costs too much, go too cheap and standards slip. A 2mm wide capacitor (0805 packaged 10uF) can be ten times cheaper than a 1.6mm wide part (0603 package), for example, and then there's the bill for the robotic component placement in the factory, which is affected by design decisions - maybe two capacitors could be replaced by a larger one. These little savings, a penny at a time, add up for a $35 device that's being produced (at least, initially) in modest batches of 10,000 units at a time.
"Our desire is to kill off even components that cost a few tens of cents as, after all, each 25 cents is 1 per cent of our price," Eben Upton, a trustee of the RaspberryPi Foundation that's producing the board, told The Register.
Your baseline, unavoidable cost is some RAM and an application processor. Depending on the choices you make, this is going to cost the best part of $15, and then you're looking at a few dollars of board, connectors, assembly and margin. So we've gone pretty much as low as you can reasonably go.
I believe pretty strongly that the "natural" long-term price of a productivity computer is under $50 plus a display.
The RaspberryPi production board PCB layout (Click for unlabelled version) Legend: 1. Misc I/O pins 2. RCA video out 3. Audio out 4. Status LEDs 5. USB 2.0 port 6. Ethernet port 7. JTAG pins 8. LAN/USB controller chip 9. HDMI out 10. Broadcom processor package 11. Underside SD card slot 12. microUSB power in
Eventually the timing circuits for the network and USB ports will be derived from a signal from the BCM2835 graphics processor rather than a clumsy external crystal oscillator. The Pi also slurps its power from a 5V micro USB socket, rather than an onboard PSU, in another bid to drive down the cost - an engineering decision taken within the past couple of months. There are all sorts of adjustments the team hope to make in future board revisions. Upton added:
The main challenge has been to get a high-quality signal escape from the BCM2835 processor, without loading the board up with lots of layers and high-density interconnect features (such as buried vias, etc). In principle there's nothing stopping us from going smaller, except that we would start sacrificing connectors and/or moving to less robust connector formats like micro SD and mini HDMI.
By and large, it's been a continuous process of small improvements and cost optimisations; Pete Lomas (one of our trustees, and MD of Norcott Technologies in Cheshire) has spent a lot of time working iteratively with potential suppliers to find cheap, decent quality components (particularly connectors). Pete has been working on sourcing components since at least May of this year, if not before, and has only recently come up with a configuration which he feels is near optimal. Silicon chip sourcing is simply a matter of what we can get our hands on that fits the target price and gives the best performance.
RaspberryPi Atmel-powered prototype
The Pi has certainly come from very humble beginnings: a 2006 prototype used an Atmel ATmega644 micro-controller, an 8-bit beast running at 22MHz with 64KB of flash memory, and 512K of static RAM mainly for the video frame buffer. A RaspberryPi in a USB key stick with a little camera fitted was demonstrated earlier this year, but the design was put on pause because it lacked the connectivity present on the latest boards.
So how will it help my kid to become a wealthy engineer?
The aforementioned RaspberryPi Foundation is a registered UK charity, whose trustees include David Braben, Jack Lang, Robert Mullins, Pete Lomas, Alan Mycroft and Upton. Braben is best known for co-creating space flight sim Elite; Lang is what's known as a serial entrepreneur; Lomas's Norcott biz will be manufacturing the Pi board; and Mycroft is director of studies for computer science at the University of Cambridge and once upon a time co-authored the Norcroft ARM C/C++ compiler suite.
As well as founding the RaspberryPi Foundation, Cambridge graduate Upton is associate technical director and SoC architect at chip powerhouse Broadcom – the company that designed the Pi's silicon heart. Although the alpha revision of the Pi's circuit board is stamped with the Broadcom logo, everyone involved stresses that the Pi is not a Broadcom product nor is the berry-flavoured project commercially affiliated with Broadcom, which is otherwise occupied with churning out wireless and broadband equipment and raking in billions in revenue.
However by working at Broadcom's Cambridge office, Upton has helped secure the team a source of chips for modest production runs – usually if you ask Broadcom for a part, they'll reply: "How many million do you need per quarter?" It has also helped the foundation to get hold of the information it needs to design a motherboard and write driver software for the BCM2835; there are no publicly available documents for the chip, although the internal ARM core is documented.
As a charity, the foundation isn't after making massive profits, that's evident from the price tag. Instead, it wants to "promote the study of computer science and related topics, especially at school level, and to put the fun back into learning computing". The trustees are upset that there are so few 10-year-olds learning how to write even simple programs, that there are not enough teachers with the skills to teach computer science for beginners, and that the days of scamps typing in
REPEAT:PRINT "Hello, world! ":UNTIL FALSE on a machine in a computer shop and legging it are long, long gone.
The popularity of home micros in the 1980s, fuelled by the BBC's computer literacy project that bankrolled the launch of the accompanying Acorn BBC Micro, led to a boom in teenage hackers who are today's engineers, application programmers and game developers. But games consoles and family PCs, which dissuaded ordinary users from experimenting with their systems, ate into the home hacking arena, Upton reckons, and it became too expensive to give kids a simple computer to toy with: there was no platform to simply learn computer science on from a young age and the RaspberryPi hopes to change all that.
Upton, who began programming at the age of 10 on a BBC micro with 16K of RAM, says creating and manipulating graphics ought to lure youngsters into giving programming a go, and luckily we have more than just MODE 7 to work with. He told us:
Obviously I'm biased with respect to the Broadcom part, but the high-end media features are a big draw for us; 1980s machines drew kids in with their graphical capabilities and then turned them into programmers, and we'd like to repeat this.
We're now many leagues away from the days of simple graphics hardware: the hardware-accelerated graphics are harnessed by firing packets of commands at the Pi's GPU using a special closed-source binary blob provided by Broadcom – although virtually all software will access the chip through a widely supported open-source OpenGL ES driver. However such mixing of closed and open source material at the kernel level has startled some, including Linux grandee Alan Cox, although it's more of a headache for anyone maintaining or building from scratch kernels for the Pi using upstream sources. Newbies and most users won't have to worry about it.
Besides, even if the GPU's documentation were made available, writing an open-source driver library will be a trifle difficult unless wading through 600 pages of documentation and a memory map of 5,000 control registers appeals to you.
Upton said: "The GPU is accessed exclusively through an OpenGL ES driver, which talks to the GPU via a sockets-like interface in the kernel. There's not much chance of directly poking registers in the hardware, I'm afraid."
Pushing to hobbyists first, then the classrooms
Initially, the foundation wanted every kid to have a Pi in their rucksack, but it has become less ambitious over time as it sought equilibrium with reality. Rather than go straight into the classroom, the foundation hopes to first bag a following of hobbyists, casual developers and home users, who will help fortify the platform's software base, documentation and support channels, before the team forays deep into the realm of education.
A survey of IT pros in September revealed that they'd happily take on self-taught developers; Upton, who believes kids are more likely to hack away in their bedroom than in ICT curriculum-strangled schools, told us:
As the project has gone on, we've backed away a little from directly promoting a curriculum, or even the device itself, into education. We've seen that there's a pre-existing push to boost science, technology, engineering, and mathematics subjects, and we see ourselves as a component supplier to this effort.
That said, we've seen a fair bit of interest from individual teachers, mostly in the private sector, who are interested in how they can incorporate the device either into formal lessons or after-school clubs.
Users can run Debian, Fedora and ArchLinux ARM GNU/Linux distributions on the Pi, although not Ubuntu at this time. SD cards containing pre-built distros will go on sale, although confident punters can build their systems from the sources. Once the OS has booted, you're faced with a very familiar Linux system: desktop and command-line interfaces, web browsing, tweeting, your favourite document editing programs and many other packages ported to the ARM architecture will be available to use as normal. As far as the end-user is concerned, it's a generic Linux system - although, obviously, Linux x86 binaries won't run out of the box.
Fedora boots to a command prompt in just shy of 25 seconds (which is mostly slowed down by the SD card's rootfs, external USB-connected hard disks are said to work extremely well with the Pi). From there wannabe engineers can get straight into friendly development environments, such as Kids Ruby and Scratch, or a BASIC interpreter. How effective BASIC and such languages will be at equipping kids with the right skills to compete in the coming decades remains to be seen - but it's a good start.
Bringing the computer literacy dream full circle, there are ongoing efforts to port a particular flavour of RISC OS to the Pi, the rather rudimentary operating system (by today's standards) that was created by Acorn for its educational and home computers in the years after the UK moved on from the BBC Micro. It's by far simpler to dig into than Linux and comes with BBC BASIC, so it'll either serve as a curious addition to the Pi project or influence a cut-down Linux distro to serve education. The RaspberryPi Foundation is working with distro organisations to create OS builds optimised for the Pi and other low-footprint systems.
And, as a further interesting aside, ex-Acorn employee, BBC Micro designer and ARM processor co-architect Sophie Wilson now works for ... Broadcom.
The RaspberryPi Model A and Model B (a reference to the BBC Micro) are expected to go on sale in December priced $25 and $35 (16 and 22 quid respectively). The Model A will have 128M of RAM and no Ethernet, whereas the Model B will be produced in larger numbers and have 256M of RAM plus 10/100MBit networking.
Although bare boards will be made available first, Upton said he expects the foundation to offer a cased version with electronic documentation next year for the same price. Meanwhile, the Pi has some rivals: the closest being Texas Instruments and Digi-Key's BeagleBone, which is a small 720MHz ARM Cortex-A8-powered computer for about 60 quid. Although the Pi gang hopes to make all its schematics and associated low-level documentation available for all, the Beagleboard project actively publishes its engineering materials under an open-source licence.
"In five years' time, we'll be looking back on the era of $300 Intel system units in bemusement," Upton concluded. ®