PocketBeagle PRU

Ring oscillator with the PocketBeagle's PRU

The crowned champion of the ring test, the PRU hits 16.6MHz

This ring oscillator runs on the PocketBeagle's PRU -> 'Programmable Realtime Unit'. The PRU is juse one component of the SOC which makes up a pocket beagle, namely the Octavo Systems' OSD3358 with 256 BGA pads. The same PRU is embedded in the TI Sitara AM3356 processor.

The PRU is especially insteresting for the ring test because it (a 200MHz cpu) shares memory with the PocketBeagle's 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.

Here's a link to the source code on github, along with other beagleboard pru examples

/*
 *
 * 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 
#include 
#include 
#include 
#include 

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);
        }
}

Back