Alright, I’m making some progress, but am having some issues:
- I can’t seem to get my device tree to change the mode of pins associated with the pruss, but other pins are configured correctly. Is there some kind of order that the PRU firmware and device tree has to load in?
/* Start EBB-PRU-Example.dts */
/dts-v1/;
/plugin/;
/ {
compatible = “ti,beaglebone”, “ti,beaglebone-black”;
part-number = “EBB-PRU-Example”;
version = “00A0”;
/* This overlay uses the following resources */
exclusive-use =
“P9.11”, “P9.13”, “P9.27”, “P9.28”, “pru0”;
fragment@0 {
target = <&am33xx_pinmux>;
overlay {
gpio_pins: pinmux_gpio_pins { // The GPIO pins
pinctrl-single,pins = <
0x070 0x07 // P9_11 MODE7 | OUTPUT | GPIO pull-down
0x074 0x27 // P9_13 MODE7 | INPUT | GPIO pull-down
;
};
pru_pru_pins: pinmux_pru_pru_pins { // The PRU pin modes
pinctrl-single,pins = <
0x1a4 0x05 // P9_27 pr1_pru0_pru_r30_5, MODE5 | OUTPUT | PRU
0x19c 0x26 // P9_28 pr1_pru0_pru_r31_3, MODE6 | INPUT | PRU
;
};
};
};
fragment@1 { // Enable the PRUSS
target = <&pruss>;
overlay {
status = “okay”;
pinctrl-names = “default”;
pinctrl-0 = <&pru_pru_pins>;
};
};
fragment@2 { // Enable the GPIOs
target = <&ocp>;
overlay {
gpio_helper {
compatible = “gpio-of-helper”;
status = “okay”;
pinctrl-names = “default”;
pinctrl-0 = <&gpio_pins>;
};
};
};
};
/* End EBB-PRU-Example.dts */
- I’ve got one of the TI examples compiled running as /lib/firmware/am335x-pru0-fw
dmesg seems to show that it loads successfully, without errors.
#include <stdint.h>
#include <pru_cfg.h>
#include “resource_table_empty.h”
volatile register uint32_t __R30;
volatile register uint32_t __R31;
void main(void)
{
uint32_t gpio;
/* Clear SYSCFG[STANDBY_INIT] to enable OCP master port */
CT_CFG.SYSCFG_bit.STANDBY_INIT = 0;
/* gpio = 0x000F; /
/ gpio = (1 << 5); */
gpio = 0x0010;
__R30 = 0x0;
/* Toggle the LEDs /
/ TODO: Create stop condition, else it will toggle indefinitely */
while (1) {
__R30 ^= gpio;
__delay_cycles(100000000);
}
}
As you can see, main is an infinite loop. This means that if I try to rmmod pru-rproc, I get the following error:
rmmod: ERROR: Module pru_rproc is in use
This means that I have to reboot in order to update the code. How do I either force the pru to unload or send it signals to stop so I don’t have to reboot everytime?
Thanks again!
–David