Chip Letter Links No 14: Raspberry Pi Pico
Great links, images and reading for 26 February 2023
Hi everyone and thanks for subscribing. This is one of a regular series of posts with links, images and articles of interest, inspired by Adam Tooze’s excellent Chartbook.
Each edition starts with a beautiful image. This week we have a x-ray of a Raspberry Pi Pico courtesy of ‘ultra purple’ on Flickr.
The Chip Letter is 100% reader supported, so if you’d like to support us then please consider taking out a paid subscription. Thanks to everyone who has taken out a paid subscription already!
The Chip Letter is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.
As we’re in the middle of a series of posts on ‘The Story of Arm’ (Part 1 , Part 2, Part 3 Coming soon!) it feels like a good time to have a ‘Links Post’ dedicated to one of the most famous users of Arm CPUs: that’s the Raspberry Pi.
In case you’ve been living under a rock for the last ten years, Raspberry Pis are a series of small (at most credit card sized), relatively cheap, single board computers, together with some larger Pi based computers.
The Raspberry Pi shares more than a series of CPU cores with Arm. They both have their origins in the University of Cambridge, where Pi founder Eben Upton was a lecturer in computer science.
They both have their roots in computer education. Arm was built as replacement CPU for the BBC Micro, the centrepiece of the UK’s computer literacy program in the 1980s. The Raspberry Pi was created in 2012 as a teaching aid, so that children could get their hands on a capable single board computer.
Today a whole range of Pi’s have been created and the Pi has outgrown its roots to be used in a huge range of other situations. I’m willing to bet that a significant proportion of ‘Chip Letter’ readers have at least one Pi tucked away somewhere.
Raspberry Pi is not beyond criticism - including for their use of proprietary firmware and recent shortages - but their record of long term support and as the work of the Raspberry Pi Foundation as an educational charity is unrivalled.
Here is a short video, from the Raspberry Pi Foundation, describing it’s origins and history (and from here on I’m going to abbreviate Raspberry Pi to RPi).
The RPi Foundation also publishes a (paper) magazine, full of materials and projects for the RPi. It’s even available as a free pdf download. At the time of writing, there were 127 issues available for download. That’s a lot of pdfs to download so here is a small selection of highlights that might be of interest:
Macintosh SE/30 : With the original electronics removed and running entirely on a RPi 4. (MagPi 119, page 20).
Laptop Pi : Build a simple laptop with a RPi Zero (MagPI 75, page 22)
Retro Gaming : Build a retro gaming handheld (MagPI 55, page 14)
(Note that there is a request for a donation to the RPi Foundation in each case but it’s possible to click past this).
But this is just a small selection. If you’re interested in hardware projects the whole archive is a goldmine!
For the rest of this edition, we’re going to focus on the smallest of the RPi family, the Pi Pico.
Comparing the ARM 1 with the Pi Pico
You can buy the simplest and cheapest RPI, the Pi Pico, launched in 2021, for as little as $4.
The Pico has an PI2040 System-on-Chip - the first SoC designed by Raspberry Pi themselves, which in turn contains two Arm Cortex M0+ CPUs. The Cortex M0+ is one of the simplest modern Arm cores and the one of the closest to the original ARM 1 in many ways.
So how does the PI2040 compare with the original ARM 1 CPU that we discussed in the Arm Story Part 1?
Well first of all the two are not code compatible, as the Cortex M0+ CPUs runs the compressed 16-bit ‘Thumb’ code (we’ll cover this in more detail in Part 3 of the Arm story) rather than Sophie Wilson’s original 32-bit ARM instruction set. Here’s a quick comparison of the specifications of the two machines. It’s worth bearing in mind that the ARM 1 cost around $150 in 2023 terms.
Clock Speed : 6 MHz (ARM 1) vs 133 MHz (and overclockable to 400MHz!) (Pico)
Cores : Single Core (ARM 1) vs Dual Core (Pico)
Instructions : 45 (ARM 1) vs 56 (Pico)
Memory (up to) : 64 MB (ARM 1) vs 16 MB (Pico)
Power Draw : 100 mW (ARM 1) vs <2 mW per core (Pico)
That’s quite a leap forward in performance and power consumption even from one of the simplest modern Arm cores.
BBC Micro Emulation
If the Pi Pico is so fast when compared to the ARM 1 then could the Pico emulate it’s counterpart as an educational computer from the 1980s, the BBC Micro?
There is just one complication. The BBC Micro had dedicated circuits for video output which are lacking from the Pi.
The answer, from Graham Sanderson, is to use the second Cortex M0+ core to drive the video. So here we have a Pi Pico emulating a BBC Micro, including some of the more famous games for the Beeb.
The source code for the project is here.
Pi Pico Doom
If the PI Pico can emulate the BBC Micro then maybe it can even play …. Doom.
Yes it can. In fact, in this project also from Graham Sanderson, it can even play multiplayer doom! It’s quite a challenge to get it to work on an Pi Pico with 2MB of flash memory though:
… getting the whole shareware game to fit in 2M is hard work. The level data, music and graphics are all compressed in novel/custom manners. All compressed level data and graphics must be random-accessible in flash, as there is no spare RAM to compress even one level worth of anything. All in all there are quite a number of interesting and perhaps unusual techniques used to shoe-horn the data into the new WHD (“Where’s Half the Data”) format, and they are described in this section. Additionally, the saved game format had to be shrunk by a factor of about 10x to store saved games in flash too!
Lots of ingenuity in other areas is needed too.
Full details here and the source code on Github is here.
Pi Pico Die Shots
We love die shots at the Chip Letter so here are links to a great series for the Pi Pico posted by John McMaster. Click through for the full thread with a complete set of images.
There is even one with the Raspberry Pi Logo
This week’s paid subscriber links focus on programming the Pi Pico, including a web based emulator. Please consider supporting The Chip Letter and becoming a paid subscriber.