<html> <head> <style> pre code { background-color: #eee; border: 1px solid #999; display: block; padding: 20px; } </style> </head> <body> <h1>BeagleBoard PRU</h1> <figure> <img src='ring.jpg' height=50%> <figcaption>Ring oscillator with the BeagleBoard's PRU</figcaption> </figure> <p>The crowned champion of the ring test, the PRU hits 16.6MHz</p> <p>This ring oscillator runs on the beagleboard's PRU -> 'Programmable Realtime Unit'. The PRU is especially insteresting for the ring test because it (a 200MHz cpu) shares memory with the Beagleboards' larger onboard processor. This is probably exciting when we run big (and asychronous) software on the large processor, (i.e. an OS, which processes operations in a queue) and want to do tightly controlled realtime work at the same time. Memory sharing means we can pass messages between these contexts quickly.</p> <a href="https://github.com/beagleboard/cloud9-examples/blob/master/extras/pru/ring.pru0c">Here's a link to the source code on github, along with other beagleboard pru examples</a> <pre> <code> /* * * Build and run with: * make -C /var/lib/cloud9/examples/extras/pru PRUN=pru0 TARGET=ring * * Makefile source at: * https://github.com/beagleboard/bone101/blob/gh-pages/examples/extras/pru/Makefile * */ #include <stdint.h> #include <pru_cfg.h> #include <pru_ctrl.h> #include <stddef.h> #include <rsc_types.h> volatile register unsigned int __R30; volatile register unsigned int __R31; struct my_resource_table { struct resource_table base; uint32_t offset[1]; /* Should match 'num' in actual definition */ }; #pragma DATA_SECTION(pru_remoteproc_ResourceTable, ".resource_table") #pragma RETAIN(pru_remoteproc_ResourceTable) struct my_resource_table pru_remoteproc_ResourceTable = { 1, /* we're the first version that implements this */ 0, /* number of entries in the table */ 0, 0, /* reserved, must be zero */ 0, /* offset[0] */ }; #pragma DATA_SECTION(init_pins, ".init_pins") #pragma RETAIN(init_pins) const char init_pins[] = "/sys/devices/platform/ocp/ocp:P2_30_pinmux/state\0pruout\0" \ "/sys/devices/platform/ocp/ocp:P2_32_pinmux/state\0pruin\0" \ "\0\0"; void main(void) { /* Read GPIO input 2 and invert to GPIO output 3 */ while(1) { if(__R31 & (1<<2)) __R30 = 0; else __R30 = (1<<3); } } </code> </pre> <p><a href='../../index.html'>Back</a></p> </body> </html>