HackSpace magazine

RP2040 in depth

By Ben Everard. Posted

The brand new RP2040 microcontroller powers Raspberry Pi Pico and a range of other new microcontroller boards from Adafruit, Sparkfun and Pimoroni. You can get your own Pico by buying the paper version of HackSpace mag issue 39 or subscribing from £10. Click here to subscribe if you're in the UK, or here if you're elsewhere in the world.

Let's take a look at what's going on inside the little black chip.

Processing power

RP2040 has two 32-bit ARM Cortex-M0+ processors running at up to 133MHz (or even more if you want to try overclocking). Microcontroller performance is a bit more nuanced than, say, PC performance because size, power, and cost trade-offs are often important. RP2040 is more than capable for most common microcontroller use-cases: you should find that it has plenty of horsepower. Additionally, RP2040 has optimised floating-point routines in the boot ROM which give it a speed boost.

Communication protocols

RP2040 is a great microcontroller, but you’re likely to need additional parts to build up your projects, and this means you need a way of communicating with them. To make this quick and easy, RP2040 has hardware support for two I2Cs, two SPIs, and two UART buses. If this isn’t enough – or you want to connect more esoteric hardware, you can use Programmable Input and Output which is a unique new method for efficiently handling data coming in or going out. You can find out more information about PIO here.

Low power

The Cortex M0+ cores in Pico don’t suck up a lot of power when running normally, but if you want your projects to run long-term on battery power, they may draw a little too much current. Fortunately, they have a couple of features to help get the most out of limited power sources. Sleep and Dormant modes can drop the power consumption of a Pico down to around 1 mA. In these states, the Pico can’t do any processing, but it can wait for a particular event (such as time signal from the real-time clock, or a signal on a GPIO pin), then wake up and perform a particular task (such as read a sensor and save the value).

Dual core

There are two Cortex-M0+ processor cores in Pico, and each of them is capable of the same set of things. This, for example, allows you to dedicate one core to just running an interface (or set of outputs) while the other takes data in and processes it. Obviously, this lets you do more processing in a given time, but it can be just as useful for simplifying your code. If you’ve got something that needs constant attention (such as an animation you want to proceed smoothly, or a data stream that needs constant processing), you can dedicate one core to just this while the other core handles all the ancillary tasks. Your timing-critical code can then just run uninterrupted and the other bits can still get processor time.

Real-Time Counter (RTC)

Pico includes a timer that can be used with an external reference clock to get the time in human-compatible units such as days, months, and years. This RTC can also be used to generate alarms at particular points. If you want, for example, a particular task to run every day at 10 am, the RTC can trigger it. Similarly, if you want something to trigger an action in a set amount of time (such as a 30-second timeout), the RTC can help.

Fully connected bus

There’s quite a lot going on inside the black package of RP2040 – including two processor cores, peripherals for many protocols, and PIO – and these all need to access memory. The fully connected bus fabric gives fast and predictable performance, even when lots of things are happening at once.

Head here to find out more about Programmable I/O, the unique feature of RP2040 that let's you easily connect high-speed peripherals.

You can get your very own Pico by getting a paper copy of HackSpace mag issue 39 or subscribing to HackSpace magazine from just £10. If you're in the UK head here. For delivery elsewhere in the world, take a look here.


https://hsmag.cc

From HackSpace magazine store

Subscribe