Who needs a Raspberry Pi microcontroller chip? Maybe you – EEJournal
Many semiconductor vendors, including TI, NXP, STMicroelectronics, Microchip, and others, are playing in the microcontroller market. As with almost every semiconductor niche, microcontrollers have been getting bigger and worse for decades. In the 1970s, there were 4-bit microcontrollers for VCRs and other simple consumer electronics. There were loads 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 families of microcontrollers with literally hundreds of variants in each family. Nowadays, 32-bit microcontrollers are very common.
Motorola Semiconductor was by no means unique among microcontroller manufacturers. Microcontroller variants from each chip vendor seemed to proliferate like rabbits, and each microcontroller vendor offered its own proprietary architectural flavor – or several flavors. When it was founded in 2002, Renesas consolidated a set of Japanese microcontroller architectures from Hitachi, Mitsubishi, and ultimately NEC. Then Arm started chasing the microcontroller market and within a decade or so had put all these proprietary microcontroller processor architectures out to pasture.
Microcontrollers are not glamorous pieces. They are not made with the latest lithograph. They do not require exotic packaging or chip assembly. They don’t burn 100 watts. Given that, you might think they weren’t an essential part of the silicon menagerie. Don’t make a mistake. Microcontrollers are essential members of silicon ecology.
When I wrote “How long will it take for the flea shortage to subside?” Last October, I specifically chose a photo of a vast sea of Ford pickup trucks strewn across the landscape as a defining snapshot of scarcity. These trucks were waiting for microcontrollers. Microcontrollers are not the thoroughbreds of the processor world; they are beasts of burden.
Well, there’s a new microcontroller vendor in town and they want your business. Plus, he has enough semiconductor dice on hand for 20 million coins. You have most likely heard of this provider. It’s Raspberry Pi. And they are ready to sell you microcontroller chips by the coil through Raspberry Pi Direct at 70 cents each for a reel of 3400 fixtures. Just want one? It will be a dollar, please.
Raspberry Pi named its microcontroller the RP2040. It’s the same microcontroller found on the Raspberry Pi Pico board, which the company introduced last year. There is already 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 cards. It’s what you expect from Raspberry Pi.
How many microcontrollers do you get for a dollar? (And how much don’t you get?) Well worth a look.
Here is a block diagram of the Raspberry Pi RP2040 microcontroller:
First, I have to say this. You get a lot of microcontroller for a dollar. It is a 32-bit dual-core microcontroller with 264 KB of on-chip RAM and an excellent assortment of peripherals typically found in a microcontroller. It’s also important to note what you don’t get. There is an on-chip Flash EEPROM, so program code must be stored elsewhere when power is removed. This might seem like a big disadvantage compared to other microcontrollers with on-chip Flash for program and data storage, but it allows you to put a lot of program memory into your design with an 8-bit SOIC NAND Flash. pins. On the negative side, the Flash chip will likely cost more than the microcontroller.
The RP2040 can execute code directly from its internal RAM or from external memory (RAM or ROM) connected via 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. Additionally, the RP2040 does not have built-in Ethernet or wireless capability. Despite these limitations, this is a very capable device.
It is apparent from the company’s design and marketing materials that Raspberry Pi developed the RP2040 microcontroller to serve as a faster, more capable processor where you might otherwise use an Arduino. If I was in marketing at Raspberry Pi, I might toss around the word “powerful” with abandon, but that’s not the case. 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 higher code density. An important point: these CPU cores do not have an L0 instruction cache, so instruction cycle time is deterministic when executing code from on-chip RAM. You need this determinism for precise I/O control in many microcontroller applications. At the time, all microcontrollers featured deterministic instruction cycle times, but times have changed. The RP2040 is old school on this point.
There’s another notable feature of the Arm Cortex-M0+ CPU cores in the RP2040: they have hardware multipliers. This is an important feature if your application requires any amount of mathematical calculations. It’s also very handy for machine learning applications.
The peripheral complement of the RP2040 includes:
- Two UARTs
- Two SPI controllers
- Two I2C controllers
- Sixteen PWM channels
- A USB 1.1 and PHY controller, with host and device support
- Two PIO blocks
Most of these devices should be familiar to you, but the last item, the PIO blocks, probably isn’t. Each of the two PIO units is a small I/O controller, consisting of eight one-way FIFO memories (four inputs and four outputs), four complex state machines, a 32-input instruction memory shared by the four state machines and an interrupt controller. The four state machines simultaneously execute programs from the shared instruction memory of the PIO unit. There are only nine PIO instructions, and Raspberry Pi has incorporated a PIO assembler into the RP2040 microcontroller SDK.
The FIFOs of the PIO units queue the 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 up to 30 GPIO pins.
What can you do with these PIO units? They can be used to generate accurate waveforms and can support a variety of existing I/O standards, including:
Emulation of 8080 and 6800 parallel bus protocols
- I2S 3 pin
- SPI, DSPI, QSPI
- DPI or VGA (using DAC resistor)
PIO programming can be assembled directly by a human programmer, taken from the Raspberry Pi PIO library, or programmatically generated by the application software. I’m sure a cult will grow around these PIO units.
There’s a lot more to the RP2040’s 56-pin QFN package. I have only touched on a few highlights to pique your interest. I recommend downloading the 654-page spec sheet and taking a look. However, RP2040 silicon is not even half the story. The real attraction, for me, is the existing ecosystem that already surrounds 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 others based on the RP2040 microcontroller, are also available from Amazon, for slightly higher prices. Many are included in Amazon’s Prime shipping program, so you can schedule an RP2040 in a day or two, if you want. It’s a convenient and inexpensive way to immerse yourself in the world of microcontrollers.