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
    • SPI, DSPI, QSPI
    • 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
Jul 20, 2024
If you are looking for great technology-related reads, here are some offerings that I cannot recommend highly enough....

featured video

Larsen & Toubro Builds Data Centers with Effective Cooling Using Cadence Reality DC Design

Sponsored by Cadence Design Systems

Larsen & Toubro built the world’s largest FIFA stadium in Qatar, the world’s tallest statue, and one of the world’s most sophisticated cricket stadiums. Their latest business venture? Designing data centers. Since IT equipment in data centers generates a lot of heat, it’s important to have an efficient and effective cooling system. Learn why, Larsen & Toubro use Cadence Reality DC Design Software for simulation and analysis of the cooling system.

Click here for more information about Cadence Multiphysics System Analysis

featured chalk talk

Designing for Functional Safety with Infineon Memory
Sponsored by Mouser Electronics and Infineon
In this episode of Chalk Talk, Amelia Dalton and Alex Bahm from Infineon investigate the benefits of Infineon’s SEMPER NOR Flash and how the reliability, long-term data retention, and functional safety compliance make this memory solution a great choice for a variety of mission critical applications. They also examine how SEMPER NOR Flash has been architected and designed for functional safety and how Infineon’s Solutions Hub can help you get started using SEMPER NOR Flash in your next design.
Apr 22, 2024
13,194 views