Hi All,
I have spent a few days to run an example on PRU. I have followed many articles and at last, I found an useful article.
Note: Some steps are historic but fixed it.
But i would like to know that for example,
I prepared a device tree file and i added it.
and
I prepared a pru program as .p extension . You can find these below. I want to use P8_p12 pin to get an output.
/dts-v1/;
/plugin/;
here is the device tree file.
/ {
compatible = “ti,beaglebone”, “ti,beaglebone-black”;
part-number = “BB-BONE-PRU”;
version = “00A0”;
exclusive-use =
“P8.12”;
fragment@0 {
target = <&am33xx_pinmux>;
overlay {
mygpio: pinmux_mygpio{
pinctrl-single,pins = <
0x30 0x06
;
};
};
};
fragment@1 {
target = <&ocp>;
overlay {
test_helper: helper {
compatible = “bone-pinmux-helper”;
pinctrl-names = “default”;
pinctrl-0 = <&mygpio>;
status = “okay”;
};
};
};
fragment@2{
target = <&pruss>;
overlay {
status = “okay”;
};
};
};
here is the .p extension file
.setcallreg r29.w0
.origin 0
.entrypoint START
#define AM33XX
#define PRU0_PRU1_INTERRUPT 17
#define PRU1_PRU0_INTERRUPT 18
#define PRU0_ARM_INTERRUPT 19
#define PRU1_ARM_INTERRUPT 20
#define ARM_PRU0_INTERRUPT 21
#define ARM_PRU1_INTERRUPT 22
#define CONST_PRUDRAM C24
#define CONST_L3RAM C30
#define CONST_DDR C31
#define GPIO1 0x4804c000
#define GPIO_CLEARDATAOUT 0x190
#define GPIO_SETDATAOUT 0x194
#define CONST_PRUSHAREDRAM C28
#define CTBIR_0 0x22020
// Address for the Constant table Block Index Register (CTBIR)
#define CTBIR 0x22020
// Address for the Constant table Programmable Pointer Register 0(CTPPR_0)
#define CTPPR_0 0x22028
// Address for the Constant table Programmable Pointer Register 1(CTPPR_1)
#define CTPPR_1 0x2202C
#define sp r24
#define lr r23
START:
LBCO r0, C4, 4, 4
CLR r0, r0, 4 // Clear SYSCFG[STANDBY_INIT] to enable OCP master port
SBCO r0, C4, 4, 4
LOOPN:
MOV r3, 0x00012000
LBBO r4, r3, 0, 4
QBEQ EXIT, r4, 255
SET r30, 14
MOV r2, r4
CALL DEL
CLR r30, 14
MOV r2, 2000
CALL DEL
JMP LOOPN
DEL: //delay r2 * 10 us
MOV r5, 1000
INDEL:
SUB r5, r5, 1
QBNE INDEL, r5, 0
SUB r2, r2, 1
QBNE DEL, r2, 0
RET
EXIT:
MOV R31.b0, PRU0_ARM_INTERRUPT+16t
HALT
firstly i compiled .dts file.
and i copied .dtbo file to /lib/firmware location
and i run it with echo commands.
and i checked it with cat commands.
after device tree activation
I run .p file with this command
pasm -p prufile.p
and i got 0 errors after compilation and also i have prufile.bin file.
The question is how can i run prufile.bin file on the processor?
Best Regards,
Eren Basturk