I am slowly mulling through being able to actually have my BBB do things
that are useful. The next hurdle is getting a pin on P8/P9 that I can
output from the two PRUs. I have written a PRU code and "think" i have run
it ok on the first PRU. FYI, I am enabling the PRU with the
BB-BONE-PRU-01.dtbo that is in /lib/firmware. It is the only cape I have
added.
I have reviewed example code, and I can not figure out how one maps a PRU
register bit to a Header pin. I attempted to just loop and toggle a pin
which I think is P8.3, using code I found in the Light control project on
the TI wiki. But that doesn't appear to be working (it looks like very so
often, something else is writing to that pin).
This is what I have:
// Make DMX pin mask
MOV r6, DMX_PIN //DMX_PIN set to 6
LBCO r2, CONST_PRUDRAM, r6, 1
MOV r4, 1
LSL r4, r4, r2.b0
TOGGLE:
// 1. Bring low for 92 us
MOV r6, GPIO1 | GPIO_CLEARDATAOUT
SBBO r4, r6, 0, 4
SLEEPUS 92, 1, START_LOW_SLEEP
// 2. Bring high for 12 us
MOV r6, GPIO1 | GPIO_SETDATAOUT
SBBO r4, r6, 0, 4
SLEEPUS 12, 1, START_HIGH_SLEEP
JMP TOGGLE
And in the c code, I have the following export:
// This is called with pin = 6
static void LOCAL_export_pin (int pin) {
FILE *file;
char dir_file_name[50];
// Export the GPIO pin
file = fopen("/sys/class/gpio/export", "w");
fprintf(file, "%d", pin);
fclose(file);
// Let GPIO know what direction we are writing
sprintf(dir_file_name, "/sys/class/gpio/gpio%d/direction", pin);
file = fopen(dir_file_name, "w");
fprintf(file, "out");
fclose(file);
}
But I don't really understand how to map and setup the mux (I know I will
need to do something for the other PRU).
Are there recommended examples which focus on this mapping a bit more
(using the standard device tree overlays)?
Thanks
Charles
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.