feature article
Subscribe Now

Who needs a Raspberry Pi Microcontroller Chip? Maybe You

Amazingly Capable Microcontroller From an Unexpected Vendor, Now in Stock

Many semiconductor vendors including TI, NXP, STMicroelectronics, Microchip, and others play in the microcontroller market. As with nearly every semiconductor niche, microcontrollers have been getting bigger and badder for decades. In the 1970s, there were 4-bit microcontrollers for VCRs and other simple consumer electronics. There were scads of 8-bit microcontrollers, soon followed by 16-bit microcontrollers. Motorola Semiconductor (later renamed Freescale and eventually purchased by NXP) developed the 6801, 6805, 68705, 68HC08, 68HC11, 68HC12, and 68HC16 microcontroller families with literally hundreds of variants in each family. These days, 32-bit microcontrollers are very common.

Motorola Semiconductor was by no means unique among microcontroller makers. Microcontroller variants from every chip vendor seemed to proliferate like bunny rabbits, and every microcontroller vendor offered its own proprietary architectural flavor – or multiple flavors. When it was founded in 2002, Renesas consolidated a bunch of Japanese microcontroller architectures that originated at Hitachi, Mitsubishi, and, eventually, NEC. Then Arm started to pursue the microcontroller market, and, in a decade or so, put all those proprietary microcontroller processor architectures out to pasture.

Microcontrollers are not glamorous parts. They’re not made with the latest lithography. They don’t require exotic packaging or chiplet assembly. They don’t burn 100 watts. Given that, you might think they weren’t a critical part of the silicon menagerie. Make no mistake. Microcontrollers are critical members of the silicon ecology.

When I wrote “How Long Will it Take for the Chip Shortage to Ease?” last October, I specifically chose a photo of a vast sea of Ford pickup trucks spread across the scenery as being a characteristic snapshot of the shortage. Those trucks were awaiting microcontrollers. Microcontrollers are not the thoroughbreds of the processor world; they’re the workhorses.

Well, there’s a new microcontroller vendor in town and it wants your business. Further, it’s got enough semiconductor dice on hand for 20 million parts. You’ve very likely heard of this vendor. It’s Raspberry Pi. And they’re ready to sell you microcontroller chips by the reel through Raspberry Pi Direct at 70 cents each for a reel of 3400 devices. Just want one? That’ll be a buck, please.

Raspberry Pi has named its microcontroller the RP2040. It’s the same microcontroller found on the Raspberry Pi Pico board, which the company introduced last year. Already, there’s a software development ecosystem including an IDE, a C/C++ compiler, a MicroPython interpreter, and a TensorFlow Lite machine-learning framework built around this “new” microcontroller. The company has already sold 1.5 million Pico boards. That’s what you expect from Raspberry Pi.

How much microcontroller do you get for a buck? (And how much don’t you get?) It’s well worth a look.

Here’s a block diagram of the Raspberry Pi RP2040 microcontroller:

First, I have to say this. You’re getting a lot of microcontroller for a buck. This is a 32-bit, dual-core microcontroller with 264 Kbytes of on-chip RAM and an excellent assortment of peripherals typically found in a microcontroller. It’s also important to note what you’re not getting. There’s no on-chip Flash EEPROM, so program code needs to be stored somewhere else when power is off. This may seem like a great inconvenience compared to other microcontrollers with on-chip Flash for program and data storage, but it does allow you to put a large amount of program memory into your design with an 8-lead NAND Flash SOIC. On the negative side, the Flash chip is likely to cost more than the microcontroller.

The RP2040 can execute code directly from its internal RAM or from external memory (RAM or ROM) connected through a dedicated SPI, DSPI, or QSPI interface. A small instruction cache improves code-execution speed “for typical applications” when executing code from external memory, according to the manual. Also, the RP2040 has no built-in Ethernet or wireless capability. Those limitations notwithstanding, this is a very capable device.

It’s apparent from the design and from the company’s marketing materials that Raspberry Pi developed the RP2040 microcontroller to serve as a faster, more capable processor where you might otherwise use an Arduino. Were I in marketing at Raspberry Pi, I’d possibly be throwing the word “powerful” around with abandon, but I’m not. So, I won’t.

The heart of the RP2040 microcontroller is the deal-core processor, which is based on a pair of Arm Cortex-M0+ processor cores capable of running as fast as 133 MHz. These are 32-bit microprocessor cores that use an Arm Thumb compressed instruction set for superior code density. One significant point: these processor cores have no L0 instruction cache, so instruction cycle time is deterministic when executing code from on-chip RAM. You need that determinism for precise I/O control in many microcontroller applications. Back in the day, all microcontrollers featured deterministic instruction cycle times, but times have changed. The RP2040 is old school on this point.

There’s one more notable feature of the Arm Cortex-M0+ processor cores in the RP2040: they have hardware multipliers. That’s an important feature if your application is going to need any amount of mathematical calculation. It’s also very handy for Machine Learning applications.

The RP2040’s peripheral complement includes:

    • Two UARTs
    • Two SPI controllers
    • Two I2C controllers
    • Sixteen PWM channels
    • A USB 1.1 controller and PHY, with host and device support
    • Two PIO blocks

Most of these peripherals should be familiar to you, but the last item, the PIO blocks, likely isn’t. Each of the two PIO units is a small I/O controller, consisting of eight unidirectional FIFO memories (four input and four output), four complex state machines, a 32-entry instruction memory shared by the four state machines, and an interrupt controller. The four state machines simultaneously execute programs from the PIO unit’s shared instruction memory. There are only nine PIO instructions, and Raspberry Pi incorporated a PIO assembler into the RP2040 microcontroller’s SDK.

The PIO units’ FIFO memories queue data transferred between the PIOs and the rest of the RP2040 microcontroller system. GPIO pin mapping logic allows each state machine to observe and manipulate as many as 30 GPIO pins.

What can you do with these PIO units? They can be used to generate precise waveforms and can support a variety of existing I/O standards, including:

Emulating the 8080 and 6800 parallel bus protocols

    • I2C
    • 3-pin I2S
    • SDIO
    • UART
    • DPI or VGA (using a resistor DAC)

PIO programming can be assembled directly by a human programmer, drawn from Raspberry Pi’s PIO library, or generated programmatically by the application software. I am certain that a cult following will grow up around these PIO units.

There’s a lot more crammed into the RP2040’s 56-lead QFN package. I’ve hit only a few highlights to pique your interest. I recommend downloading the 654-page data sheet and taking a look. However, the RP2040 silicon is not even half of the story. The real attraction, to me, is the existing ecosystem already surrounding this device. In addition to the software tools mentioned above, there are several low-cost, finished boards incorporating the RP2040:

These small boards, and many more based on the RP2040 microcontroller, are also available from Amazon, for somewhat higher prices. Many are included in Amazon’s Prime shipping program, so you could be programming an RP2040 in a day or so, if you wished. It’s a convenient, low-cost way to dip your toe into the microcontroller world.


Leave a Reply

featured blogs
Jan 30, 2023
Last week it was the Chiplet Design Summit in San Jose. Actually, the organizers called it the First Annual Chiplet Design Summit . Since everything was oversubscribed '” not enough chairs in the keynote ballroom, not enough box lunches '” this doesn't seem all that ar...
Jan 24, 2023
We explain embedded magnetoresistive random access memory (eMRAM) and its low-power SoC design applications as a non-volatile memory alternative to SRAM & Flash. The post Why Embedded MRAMs Are the Future for Advanced-Node SoCs appeared first on From Silicon To Software...
Jan 19, 2023
Are you having problems adjusting your watch strap or swapping out your watch battery? If so, I am the bearer of glad tidings....

featured video

Synopsys 224G & 112G Ethernet PHY IP OIF Interop at ECOC 2022

Sponsored by Synopsys

This Featured Video shows four demonstrations of the Synopsys 224G and 112G Ethernet PHY IP long and medium reach performance, interoperating with third-party channels and SerDes.

Learn More

featured chalk talk

dsPIC33CH DSCs: Two dsPIC33Cs on a Single Chip

Sponsored by Mouser Electronics and Microchip

In this episode of Chalk Talk, Vijay Bapu from Microchip and Amelia Dalton explore the benefits of dual core digital signal controllers. They discuss the key specifications to keep in mind when it comes to single core and dual core DSCs and how you can reduce your development time, save board space and cost and keep the performance and isolation you need with Microchip’s dsPIC33CH DSCs.

Click here for more information about Microchip Technology dsPIC33CH Dual Core Digital Signal Controllers