Hands-On with the RP2040 and Pico, the First In-House Silicon and Microcontroller From Raspberry Pi

The RP2040, Raspberry Pi's first in-house silicon, debuts on the Raspberry Pi Pico, its first microcontroller board — and it's just $4.

The launch of the original Raspberry Pi in 2012 was the dawn of a new era of low-cost, easy-access single-board computers (SBCs). In the years since the Raspberry Pi family has grown both upwards, now on its fourth full generation, and outwards with a range of devices from the ultra-low-cost Raspberry Pi Zero family to the consumer-ready all-in-one Raspberry Pi 400.

Now, the people behind the Raspberry Pi are looking to do for the microcontroller market what they've already done for single-board computers, with the launch of the Raspberry Pi Pico powered by the RP2040 — the company's first in-house chip, a dual-core Arm-based microcontroller.

Retailing for just $4 in single-unit quantities and with a breadboard-friendly layout — though you'll need to solder the headers on yourself — could the Raspberry Pi Pico be the next big thing in the maker and education market?

Bringing Pico to Life

"The idea is [Pico is] a component in itself," explains James Adams, Raspberry Pi chief operating officer, of the new product. "The intent was to expose as many of the IO [Input/Output] pins for users as possible, and expose them in the DIP [Dual Inline Package]-like form factor, so you can use Raspberry Pi Pico as you might use an old 40-pin DIP chip. Now, Pico is 2.54 millimeters or 0.1 inch wider than a 'standard' 40 pin DIP, so not exactly the same, but still very similar.

"After the first prototype, I changed the pins to be castellated so you can solder it down as a module, without needing to put any headers in. Which is, yes, another nod to using it as a component."

"It's a flexible product and platform," adds Nick Francis, senior engineering manager at Raspberry Pi, of the RP2040 chip which powers Raspberry Pi Pico — and which despite being an entirely in-house design by the Raspberry Pi Application Specific Integrated Circuit (ASIC) team is being made available to order for integration into third-party board designs, whether development boards or finished products.

"It would have been easy to have said well, let's do a purely educational microcontroller, quite low level, quite limited performance. But we've done the high-performance thing without forgetting about making it easy to use for beginners. To do that at this price point is really good. One of the driving requirements right at the start was to build a very low-cost chip, but which also had good performance. Typically, you'd expect a microcontroller with this specification to be more expensive, or one at this price to have a lower specification. We tried to push the performance and keep the cost down."

The Hardware

The Raspberry Pi Pico board itself is, as Adams says, a gumstick-style form factor which mimics an overly broad DIP package. Supplied with unpopulated headers, though retailers are likely to offer a pre-populated premium version in the same manner as the H-suffixed Raspberry Pi Zero boards, the board's pin headers are castellated — meaning they can be fitted with male or female 2.54mm headers or the whole Pico soldered won as a surface-mount module onto a carrier board of your own design.

At the heart of the board is the RP2040, the first in-house processor to come out of Raspberry Pi. The name is a code, detailing the features of the chip — and hinting at future versions to come: RP means, simply enough, Raspberry Pi; the 2 refers to the number of cores; the 0 to the type of core, in this case Arm Cortex-M0+; the 4 to the amount of RAM available, calculated using the equation floor(log2(ram/16k)); and finally the trailing 0 is the amount of non-volatile memory available, again using the equation floor(log2(nonvolatile/16k) and defaulting to 0 if none is available.

The RP2040 comes with a flexible clock, running up to 133MHz — though higher may be possible — along with 264kB of static RAM (SRAM). An external chip provides 2MB of flash storage, while 26 general-purpose input/output (GPIO) pins on the RP2040 are brought out to the Pico's headers.

These GPIO pins include hardware interrupts, 16 pulse-width modulation (PWM) pins, three 12-bit analog-to-digital converter (ADC) pins, two UARTs, two I2C, and two SPI buses. There's an internal temperature sensor, an on-chip clock and timer, and eight programmable IO (PIO) state machines. The USB port can also be used in both host and device modes, though software support for this is a work in progress.

Programmable IO

PIO is a particularly impressive feature, and one rarely seen on lower-end microcontrollers - particularly ones retailing for $4 in a ready-to-run development board. "It's a very flexible multi-configuration, multi-state-machine IO controller," Francis explains. "Essentially, we can interface to anything you can think of — within sensible limits."

“Maybe the way to describe it is: It's a custom processor, a core designed for bit-banging input/output [IO]," adds Adams. "It's got instructions and memory, but it's highly specialized to do IO bit-banging. It has FIFOs — first in, first out hardware memory buffers — to stuff data in, shuffle data in and out, and stuff like that. It's pretty cool."

“It gets whoever's going to use the device closer to their hardware," says Francis. "So you get to really, really think about the bits and how you're talking to the external devices. The list of interfaces it will support will grow over time, and it should be a bit of interesting fun for people to try and hook them up and make it support different things."

To make things easier, the Pico also includes a serial-wire debug (SWD) header — while the micro-USB port at the top of the board provides power and data, with a "BOOTSEL" switch allowing the board to switch to a mass-storage mode for drag-and-drop loading of new and improved firmware. The USB port, in fact, is one of the few disappointments on the board: With the Raspberry Pi 4 having made the jump to USB Type C, it's surprising to see the older micro-USB on the Pico.

Software and Documentation

All the clever hardware in the world is nothing without software support, of course. The RP2040 comes with a well-documented software development kit (SDK) for C and C++, covering all the major features and offering a cross-platform toolchain for development on Windows, macOS, and Linux — including, naturally, the Raspberry Pi family itself.

"Most people are doing a lot of the software development for this, the SDK and all the rest of it, on Raspberry Pi 4 or Raspberry Pi 400," Adams claims. "That's our primary platform of choice. Of course, we’ll make it work on everything else as well. I would hope that will be as easy to use as any other microcontroller platform out there."

While both the bare-chip RP2040 and the ready-to-run Pico module are clearly targeted at industrial users, the brains at Raspberry Pi have by no means forgotten about education: The Pico launches with an official MicroPython port, installable by simply plugging the Pico in with the BOOTSEL button held, double-clicking the introductory HTML shortcut, downloading the firmware, and dragging it onto the drive.

The majority of the RP2040's functionality is exposed in the MicroPython port: You can use hardware interrupts, PWM, the non-volatile storage, the ADC channels, the internal temperature sensor, SPI and I2C buses, create a thread to run on the second CPU core — and even use the PIO blocks, which allow you to copy and paste or write your own interface definitions directly in REPL or the Python IDE of your choice.

Not everything is ready at launch, however. One particular absence is support for using the USB port as anything other than power and UART, with no sign yet of the USB host and client functionality. Clock support is also in the preliminary stages, with machine.RTC still missing but the MicroPython time module set to capture the current date and time from the hardware clock.

Adafruit has also confirmed launch-day support for the Raspberry Pi Pico in CircuitPython, its education-focused MicroPython fork. For those looking at embedded machine learning projects, meanwhile, Google has released an official port of the microcontroller-focused TensorFlow Lite supporting the RP2040 and the Raspberry Pi Pico — though this was not available to test in time for this feature.

Conclusion

It's hard not to be impressed by the Pico, especially for a first microcontroller product — albeit one from a company which has spent the last nine years all-but dominating the single-board computer scene. While it's easy to focus on a handful of missing features, in particular the lack of Bluetooth or Wi-Fi support, there's a lot of power there — especially given the board's bargain-basement $4 price point and module-ready yet breadboard-friendly format.

There's another reason the Pico will catch people's eyes, too: It's the first device to feature Raspberry Pi's own chip. "RP2040 is an exciting development for Raspberry Pi because it’s Raspberry Pi people making silicon," says Eben Upton, chief executive and co-founder of Raspberry Pi. "I don't think other people bring their A-game to making microcontrollers; this team really brought its A-game. I think it's just beautiful."

"What does Raspberry Pi do? Well, we make products which are high performance, which are cost-effective, and which are implemented with insanely high levels of engineering attention to detail — and this is that. This is that ethos, in the microcontroller space. And that couldn't have been done with anyone else's silicon."

The $4 Raspberry Pi Pico is ready to buy from Raspberry Pi resellers now at $4 plus shipping and taxes, with more details available on the official website.

The Pico is also cover-mounted on this month's issue of HackSpace Magazine, too, in much the same way as the earlier Raspberry Pi Zero single-board computer was given away on The MagPi Magazine. Finally, Raspberry Pi has confirmed it is releasing the Allegro PCB Designer files for the Pico board, a Minimal Viable Board (MVB) for the RP2040, and a VGA Carrier Board under a permissive open source license.

NOTE:An earlier version of this article stated that it was not possible to detach the MicroPython REPL from UART0; the latest release of the MicroPython firmware has resolved this issue.

Gareth Halfacree
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.
Related articles
Sponsored articles
Related articles