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.

20 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.

  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. you do so,mething like this (and wrap it up in a m,acro)

        MOV r8, 0x22000 // control register
        lab:
        LBBO r9, r8, 0xC, 4 // read the cycle counter
        SUB r9, r9, sleep_counter
        QBGT lab, r9, (ns)/5

    1. Farnell have produced their own which they ship out when they have stock because they’ve developed their own version.

  3. Don’t you think it would help if you first told us what a PRU is ?
    Did you just assume that because you do, everyone does!

    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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s