You are on page 1of 14
PRU tips: Understanding the BeagleSone's builtin microcotrallers Ken Shirriff's blog Xerox Alto restoration, IC reverse engineering PRU tips: Understanding the BeagleBone's built-in microcontrollers The BeagleBone Black is an inexpensive, credit-card sized computer that has two built-in microcontrollers called PRUs. While the PRUs provide the realtime 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. Warning: this post uses the 3.8.13-bone79 kernel; many things have changed since then. The BeagleBone uses the Stara 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 reabtime operating system. However, the Sitara chip contains two 32-bit microcontrollers, called Programmable Realtime Units or PRUs. (I's almost fractal, having processors inside the processor.) By using a PRU, you can achieve fast, deterministic, real-time control of YO pins and devices. Tho BoagleBone computor is tiny. For some reason it was designed to ftinside an Alois mint tin. The square thumbrailsized chip i the canter is the ‘AM3358 Sitaa processor chip. This chip contains an ARM processor as well as two 32-bit microcontrollers called PRUs. The nice thing about using the PRU microcontrollers on the BeagleBone is that you get both real-time Arduino-style ipuhwwr right. cam /20168iprips-nderslaeing-boaglebenes hl chargers, and whatever Contact About Ken Shirt Popular Posts Colls are very fast and crowded places =F Bitcoin mining the hard way: the algorithms, protocols, and bytes Hands-on with the PocketBeag! e:a $25 Linux computer with lots of YO pins Fixing the Ethernet board from a vintage Xerox Alto AMulti- Protocol Infrared Remote Library for the Arduino Mining Bitcoin with pencil and paper: 0.67 hashes per Bitcoins the hard way. Using the raw Bitcoin protocol Apple iPhone charger teardown: quality in a tiny expensive package or +21820°7 PRU tips: Understanding the BeagleBone's builtin microcotrallers control, and "real computer" features such as a web server, WiFi, Ethemet, and muttiple languages. The main processor on the BeagleBone can communicate with the PRUs, giving Labels you the best of both worlds. The downside of the PRUs is 6502 8008 8085 alto apple there's a significant leaming curve to use them since they arc arduino arm have their own instruction set and run outside the familiar beaglebone —biteoin cw Linux world, Hopefully this article will help with the learning saloulator oss curve, electronics 1 tractals genome naskellntmis ibm 1404 intel ipv6 it java javascript math oscilloscope photo power supply random I wrote an article a couple weeks ago on The BeagleBone's VO pins. That article discussed the pins controlled by the ARM processor, while this article focuses on the PRU microcontroller. if you think you've seen the present article before, they cover to different things, but I won't blame you reverse- for getting deja vu! engineering sheevaplig snark spanish Running a "blink" program on the PRU teardown theory unicode Z-B0 ‘To motivate the discussion, Iluse a simple program that uses the PRU to flash an LED. This example is based on PRU GPIO example 1) Biinking an LED using the BoaglaBone's PRU microcontroller. The easiest way to compile and assemble PRU code is to do ci iton the BeagleBone, since the necessary tools are installed by default (at least if you get the Adatruit BeagleBone) Perform the following steps on the BeagleBone Power supply posts + Connect an LED to BeagleBone header P8_11 through a 1K resistor. + iPhone charger teardown + Download the assembly code file blink.p: + Adozen USB chargers ipuhwww right cam 2016 8p ips-nderslaeing-boaglebones hl ana PRU tips: Understanding the BeagleSone's ulin microcotrallers blink. p: demonstration of PRU on the BeagleBone Black blink LED connected to P8_11 ten times ‘origin 0 ‘entrypoint TOP Tor: MOV 1, 10; blink counter BLINK: SET 120, r80, 15 ; set GPIO output 15 MOV 1, 0x00200000 ; delay counter DELAY: SUB 10,0, 4 QBNE DELAY, 19, 0; loop until CLR 180, 130, 15 ; clear GPIO output 15 MOV 0, 0x00200000 ; delay counter DELAY? SUB 0,0, 1 QANE DELAY2, r0, 0 ; leap until 0 SUB ri r1.1 QBNE BLINK, +1, 0; loop until rt MOV 131.b0, 32+ 3 HALT + Download the host file to load and run the PRU code, loader. Download the device tree file, libyfirmware/PRU- GPIO-EXAMPLE-O0AO.dts. Compile and install the device tree file to enable the PRU: (olay) 0 (delay) (blink counter) 4 dtc -0 ath -1 dts -o /1ib/Firmare/PRU-cP10- EXANPLE-80R0. Isys/devices/bone_capengn.2/slots 4 cat /sys/devices/bone_capengr.?/slots + Assemble biink.p and compile the loader: # pasm -b blink.p 4 gcc -0 loader loader.c -lprussdrv + Run the loader to execute the PRU binary: 4 loader blink. bin fall goes well, the LED should biink 10 times," Documentation The most important document that describes the Sitara chip is the 5041-page Technical Reference Manual (TRM for short). This article references the TRM where appropriate, if you want more information. Information on the PRU is inconveniently split between the TRM and the AM335x PRU-ICSS Reference Guide. For specifies on the AM3358 chip used in the BeagleBone, see the 253 page datasheet, Texas Instruments has the PRU wiki with more information. you're looking to use the BeagleBone and/or PRU | highly recommend the detailed and informative book Exploring BeagleBone. Helpful web pages on the PRU include BeagleBone Black PRU: Hello World, Working with the PRU and BeagleBone PRU GPIO example. ipihwww right. cam/2016 8p ips-nderslaeing-boaglebores hl + Magsafe hacking + Inside a fake iPhone charger + Power supply history Email: kens@arcfn.com Blog Archive » 2017 (17) ¥ 2016 (34) > December (2) > October (5) > September (8) ¥ August (2) PRU tips: Understanding the BeagleBone's buill- ‘The BeagleBone’s 1/0 pins: inside the software sta, > July @) > June (4) > May (1) > April(t) > March (1) > February (4) > January (3) > 2015 (12) > 2014 (13) > 2018 (24) > 2012 (10) > 2014 (11) > 2010 (22) > 2009 (22) > 2008 (27) Quick links + Arduino IR Hibrary + 6502 reverse- engineering aa

You might also like