Monday, 2 February 2015

Raspberry Pi 2 B - First Impressions

The recently announced Raspberry Pi 2, at first look, appears exactly the same as its version 1+ predecessor. All the sockets and LED’s appear in the same place, which means most B+ cases and third party add-ons should work fine. (One exception is the Pibow Coupe, which is being modified as we speak to ensure it works on the 2B). Only when you look a little closer do you see the Broadcom logo on top of the slightly larger CPU, and realise that the device no longer uses a PoP memory chip. Looking underneath, and the expanded 1GB memory chip comes in to view.

The new SoC, the BCM2836, is a souped up version of the original BCM2835 chip used on the original Pi. It uses the same GPU (the Videocore4), but instead of the single ArmV6 device, now has four A7 cores with NEON instruction support. The cores are the recent P5 release, so very up to date. This combined with the higher memory capacity (upped from 512MB to 1GB) means a lot more capability. The clock speed of the device is set by default to 900, which is a bit quicker than the 2835. However, the added performance of the A7 cores means even single threaded applications will run faster on the new chip. Multithreaded applications that take advantage of the 4 cores should see up to a 6x improvements in pure speed. At this stage, the overclocking capabilities of the new CPU are relatively untested, but 1000 is certainly available. and I suspect that if you are willing to risk damage through overvolting, similar overclocks to the 2835 will be possible.

That’s not all though, there have also been improvements to the processors caches. The BCM2835 has a 16K instruction, and a 16K data Level 1 caches to help with memory accesses, but the BCM2836 now has 32KB L1 data and instruction per core, and in addition, a 512K Level 2 cache used by all 4 cores, but that is for the ARM onl;y and is no longer shared by the GPU.. So a total of 640K cache dedicated to the ARM’s compared to 32K. This should make a huge difference to the average memory access speed.

It’s worth comparing the A7 cores with the A5 cores used on some other SBC’s. The A5 is a dramatically cut down version of the A7. It uses the same Armv7 instruction set but has a much smaller silicon area and has a lot of performance features removed, resulting in capabilities not much better than an ARMv6 device. They are capable of higher clock speeds, but this benefit is offset by the poor instructions execution speed. So a A7 usually outperforms an A5, even one running at a higher clock speed.

The processor and memory change is the big headline, all other peripherals remains the same, which means the same GPIO’s, the same camera, same SD card, same interoperability with no changes required to the software (for 99% of applications). Given the educational nature of the device, this backwards compatibility is essential to ensure a smooth transition for schools and other learning establishments.

Everything that works on the current Pi will (or should!) work on the new one, because the A7 is backwards compatible with the v6. ALmost all the current software packages available in Raspbian should work fine on the new Pi. The kernel has been recompiled with all the new features required for the A7s (multi core etc) but appears to the end user in the same way. At the moment, there is no intention by the Foundation to move to a specific Armv7 repository as this would mean maintaining two huge repos, so for real performance users you’ll want to recompile your applications and libraries with the A7 as the target - this should give a small amount of extra speed. It should be possible to use something like the Ubuntu Armv7 repo to download precompiled packages, but I have not attempted to do this.

So, what difference does the new processor make? Well, first impressions are very favourable indeed. During boot, instead of the single Raspberry Pi appearing at the top of the console, you now have 4, one for each core. Boot time of Raspbian is about the same, perhaps a little quicker than previously. Response on the console is quicker and programs start up with much less delay than before. Running the standard LXDE as supplied shows it is immediately snappier to use. Applications again start up faster, and running more than one application at the same time doesn’t slow the device down, the faster multiple cores, and extra memory make a huge difference here. Web browsing is considerably faster, especially with the optimised browser and Scratch shows definite improvements in speed. Keeping an eye on the CPU meter shows a much lower CPU usage overall than on the original device. Compiling the Chapel compiler (C++) took just under 10 minutes on the B2+, but well over an hour on the B+, so the extra horsepower, and I think this is what makes the real difference, double the memory, makes compiling a pleasure rather than a chore.

A quick camera test using the Raspberry Pi camera with the standard demo apps, as well as some gstreamer pipelines, showed this works fine. The extra faster cores should mean faster performance in image processing with the right software. We also tried a software only H264 encode using the x264 library (compiled for ARMv6 so not completely optimised with A7 instructions and NEON etc), and managed over 20fps at VGA resolution, which is pretty impressive.

Anecdotal tests of Sonic Pi done by the Foundation show CPU usage dropping from 80% to 3% (yes, 3%). Another impressive speed improvement.

In precis, this is a great upgrade. A quad core device, with decent graphics and multimedia capabilities, completely backwards compatible with the 4M Raspberry Pi’s already out there. Is this now a desktop replacement? Well, for some, yes, I think it is. For more power hungry users, perhaps not, but for $35, there is nothing to touch the Raspberry Pi 2 Model B+, and I suspect an awful lot more Raspberries are about to be sold!