An Introduction To The BeagleBone PRU

BBB While the BeagleBone is usually compared to the Raspberry Pi, there are a few features that make the ‘Bone a vastly more capable single board computer. There is a small difference in the capabilities of the processor, but the real power of the BeagleBone comes from the PRUs available: two small cores that give the BeagleBone the hardware equivalent of bitbanging pins. [Texane] has put up two great tutorials for using the PRU in the BeagleBone that should be required reading for every BeagleBone owner.

The first tutorial goes over the capabilities of the PRUs in the BeagleBone and setting up the software environment to develop your own hardware interfaces with the PRU. While writing code for the PRU has usually involved the Beagleboard packages, TI has recently released a version of Code Composer Studio that gives the option to compile C code for the PRU.

[Texane] used this C compiler to rehash the earlier, assembly only PRU program, making development significantly easier. There’s still a bit of inline assembly, and the inline assembly support isn’t as advanced as in GCC, but it’s still much easier than the assembly only variant.

While [Texane] is using the PRU in his BeagleBone to develop something at a synchrotron facility, three are a few things where really fast hardware bitbanging comes in handy: it can be used to make a video card for a vintage mac, or any sort of VGA video card, really. Very cool stuff, especially now that you can write something in C.

21 thoughts on “An Introduction To The BeagleBone PRU

  1. So I was actually thinking of using the PRU to sample a VGA signal, effectively making a video grabber. Can anyone suggest the best way of digitising the analog VGA signal at the appropriate rate?

      1. Right, I was thinking that single-bit resolution would be fine initially, I guess the bias would be to set the level at which the bit flips? Something like a potentiometer would probably help to figure out what makes sense. Not too sure how to get the voltage from VGA spec 0-0.8V up to 4-5V, though, which seems to be required by the 7404?

        1. You don’t have to think of the 7404 as a digital device. It’s just a pair of MOSFETs, so it’s basically a really high-gain amplifier with an arbitrary transition voltage. The potentiometer to bias things up really just moves the voltage range from 0-0.7V so that it straddles the high-gain region of the 7404.

          1. Looks like the “correct” approach is to use something like the TVP7002, which will do all the signal processing for me. Thanks again for the suggestions.

    1. Yes, there is serializer/deserializer hardware, but you can also use the other peripherals on the chip similar to what was done on this AM1808 code:

      You can also use the Enhanced GPIO. Take a look at Section, Figure 8 and the rest of Section in

  2. Yes PRUs are decidedly cool – I’ve been using them to drive many long WS2812 based LED strips – making those 800kHz PWM signals having instructions that let you waay things like “wait until 450nS have passed from point X /// do something, now wait until 65nS have passed” is really useful

    1. I was wondering exactly the same thing “Programmable Real-Time Unit, a subsystem of certain ARM microprocessors”. I hate it when people use TLA’s or ETLA’s without expanding them at least once :)

    2. it’s basically a tiny extra super-fast risc core optimised for doing bitbanging on GPIOs in real-time (which in this case means 10-100nS sorts of times (or more)

      This way you can have your main CPU run a non-realtime OS like linux and still be able to do stuff at sub 1uS timings

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.