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.
“Also, those of you familiar with the GNU assembler syntax should feel at home”
I blogged about how you can wrangle GNU assembler to understand NASM-type syntax on x86. If anybody has any luck doing the same on ARM, let me know!
http://madscientistlabs.blogspot.ca/2013/07/gas-problems.html
http://processors.wiki.ti.com/index.php/Programmable_Realtime_Unit_Subsystem
THANK YOU!
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?
As a cheapo first draft, a biased BJT or 7404 as a 1-bit ADC.
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?
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.
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.
Do PRUs have serializers/deserializers?
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: http://processors.wiki.ti.com/index.php/Soft-UART_Implementation_on_OMAPL_PRU_-_Software_Users_Guide
You can also use the Enhanced GPIO. Take a look at Section 5.2.2.3.3, Figure 8 and the rest of Section 5.2.2.3 in http://beagleboard.github.io/am335x_pru_package/am335xPruReferenceGuide.pdf.
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
How so? Couldn’t find any “Wait until” instructions in the following doc: http://processors.wiki.ti.com/images/1/18/PRUSS_Training_Slides.pdf
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
Too bad the BBB is unobtanium, at least here in the EU.
Don’t buy it from a source that gives a crap where you live:
http://www.aliexpress.com/wholesale?SearchText=beaglebone&catId=0&initiative_id=SB_20140623033634
Farnell have produced their own which they ship out when they have stock because they’ve developed their own version.
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!
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 :)
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
Pick Rocks Up …I mean
There’s now a GCC compiler: http://elinux.org/Ti_AM33XX_PRUSSv2#GCC