Programmable Realtime Units – or PRUs – on the BeagleBone Black are one of the slightly underappreciated aspects of this SBC versus other single-board computers. Understanding the PRUs as separate from the main processor is easy to imagine in your head but a little less-so when you actually get to programming and navigating the ‘Bone. Which is why blogs like Ken Shirriff’s PRU tips: Understanding the BeagleBone’s built-in microcontrollers are so useful, for putting into words what some of the rest of us are thinking or wondering about!
The BeagleBone Black is an inexpensive, credit-card sized computer that has two built-in microcontrollers called PRUs. While the PRUs provide the real-time processing capability lacking in Linux, using these processors has a learning curve. In this article, I show how to run a simple program on the PRU, and then dive into the libraries and device drivers to show what is happening behind the scenes.
The BeagleBone uses the Sitara AM3358, an ARM processor chip running at 1 GHz—this is the thumbnail-sized chip in the center of the board below. If you want to perform real-time operations, the BeagleBone’s ARM processor won’t work well since Linux isn’t a real-time operating system. However, the Sitara chip contains two 32-bit microcontrollers, called Programmable Realtime Units or PRUs. (It’s almost fractal, having processors inside the processor.) By using a PRU, you can achieve fast, deterministic, real-time control of I/O pins and devices.
The nice thing about using the PRU microcontrollers on the BeagleBone is that you get both real-time Arduino-style control, and “real computer” features such as a web server, WiFi, Ethernet, and multiple languages. The main processor on the BeagleBone can communicate with the PRUs, giving you the best of both worlds. The downside of the PRUs is there’s a significant learning curve to use them since they have their own instruction set and run outside the familiar Linux world. Hopefully this article will help with the learning curve.